home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / error.cpp < prev    next >
C/C++ Source or Header  |  2000-01-06  |  142KB  |  4,739 lines

  1. // $Id: error.cpp,v 1.42 2000/01/06 08:24:30 lord Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include "config.h"
  11. #include <sys/stat.h>
  12. #include "error.h"
  13. #include "control.h"
  14. #include "semantic.h"
  15. #include "ast.h"
  16.  
  17. unsigned char SemanticError::warning[SemanticError::_num_kinds] = { 0 };
  18. void (*SemanticError::print_message[SemanticError::_num_kinds]) (SemanticError::ErrorInfo &, LexStream *, Control &) = { NULL };
  19.  
  20. SemanticError::SemanticError(Control &control_, FileSymbol *file_symbol) : num_errors(0),
  21.                                                                            num_warnings(0),
  22.                                                                            control(control_),
  23.                                                                            lex_stream(file_symbol -> lex_stream),
  24.                                                                            clone_count(0),
  25.                                                                            buffer(1024),
  26.                                                                            error(512)
  27. {}
  28.  
  29. //
  30. // This procedure is invoked by an JIKES PARSER or a semantic
  31. // routine to process an error message.  The JIKES parser always
  32. // passes the value 0 to msg_level to indicate an error.
  33. // This routine simply stores all necessary information about
  34. // the message into an array: error.
  35. //
  36. void SemanticError::Report(SemanticErrorKind msg_code,
  37.                            LexStream::TokenIndex left_token,
  38.                            LexStream::TokenIndex right_token,
  39.                            wchar_t *insert1,
  40.                            wchar_t *insert2,
  41.                            wchar_t *insert3,
  42.                            wchar_t *insert4,
  43.                            wchar_t *insert5,
  44.                            wchar_t *insert6,
  45.                            wchar_t *insert7,
  46.                            wchar_t *insert8,
  47.                            wchar_t *insert9)
  48. {
  49.     //
  50.     // Do not report errors detected while processing a clone !!!
  51.     // If we have a warning and the nowarn option is set, ignore it.
  52.     //
  53.     if (clone_count > 0 ||
  54.         (control.option.nowarn && (warning[msg_code] == 1 || (warning[msg_code] == 2 && (! control.option.zero_defect)))))
  55.         return;
  56.  
  57.     int i = error.NextIndex();
  58.  
  59.     if (warning[msg_code] > 0)
  60.          num_warnings++;
  61.     else num_errors++;
  62.  
  63.     error[i].msg_code = msg_code;
  64.  
  65.     int total_length = 0,
  66.         length1 = 0,
  67.         length2 = 0,
  68.         length3 = 0,
  69.         length4 = 0,
  70.         length5 = 0,
  71.         length6 = 0,
  72.         length7 = 0,
  73.         length8 = 0,
  74.         length9 = 0;
  75.  
  76.     if (insert1)
  77.     {
  78.         length1 = wcslen(insert1);
  79.         total_length += (length1 + 1);
  80.     }
  81.     else error[i].insert1 = NULL;
  82.  
  83.     if (insert2)
  84.     {
  85.         length2 = wcslen(insert2);
  86.         total_length += (length2 + 1);
  87.     }
  88.     else error[i].insert2 = NULL;
  89.  
  90.     if (insert3)
  91.     {
  92.         length3 = wcslen(insert3);
  93.         total_length += (length3 + 1);
  94.     }
  95.     else error[i].insert3 = NULL;
  96.  
  97.     if (insert4)
  98.     {
  99.         length4 = wcslen(insert4);
  100.         total_length += (length4 + 1);
  101.     }
  102.     else error[i].insert4 = NULL;
  103.  
  104.     if (insert5)
  105.     {
  106.         length5 = wcslen(insert5);
  107.         total_length += (length5 + 1);
  108.     }
  109.     else error[i].insert5 = NULL;
  110.  
  111.     if (insert6)
  112.     {
  113.         length6 = wcslen(insert6);
  114.         total_length += (length6 + 1);
  115.     }
  116.     else error[i].insert6 = NULL;
  117.  
  118.     if (insert7)
  119.     {
  120.         length7 = wcslen(insert7);
  121.         total_length += (length7 + 1);
  122.     }
  123.     else error[i].insert7 = NULL;
  124.  
  125.     if (insert8)
  126.     {
  127.         length8 = wcslen(insert8);
  128.         total_length += (length8 + 1);
  129.     }
  130.     else error[i].insert8 = NULL;
  131.  
  132.     if (insert9)
  133.     {
  134.         length9 = wcslen(insert9);
  135.         total_length += (length9 + 1);
  136.     }
  137.     else error[i].insert9 = NULL;
  138.  
  139.     if (total_length > 0)
  140.     {
  141.         wchar_t *ptr = new wchar_t[total_length];
  142.         buffer.Next() = ptr;
  143.  
  144.         if (insert1)
  145.         {
  146.             memmove(ptr, insert1, length1 * sizeof(wchar_t));
  147.             error[i].insert1 = ptr;
  148.             ptr += length1;
  149.             *ptr++ = U_NULL;
  150.         }
  151.  
  152.         if (insert2)
  153.         {
  154.             memmove(ptr, insert2, length2 * sizeof(wchar_t));
  155.             error[i].insert2 = ptr;
  156.             ptr += length2;
  157.             *ptr++ = U_NULL;
  158.         }
  159.  
  160.         if (insert3)
  161.         {
  162.             memmove(ptr, insert3, length3 * sizeof(wchar_t));
  163.             error[i].insert3 = ptr;
  164.             ptr += length3;
  165.             *ptr++ = U_NULL;
  166.         }
  167.  
  168.         if (insert4)
  169.         {
  170.             memmove(ptr, insert4, length4 * sizeof(wchar_t));
  171.             error[i].insert4 = ptr;
  172.             ptr += length4;
  173.             *ptr++ = U_NULL;
  174.         }
  175.  
  176.         if (insert5)
  177.         {
  178.             memmove(ptr, insert5, length5 * sizeof(wchar_t));
  179.             error[i].insert5 = ptr;
  180.             ptr += length5;
  181.             *ptr++ = U_NULL;
  182.         }
  183.  
  184.         if (insert6)
  185.         {
  186.             memmove(ptr, insert6, length6 * sizeof(wchar_t));
  187.             error[i].insert6 = ptr;
  188.             ptr += length6;
  189.             *ptr++ = U_NULL;
  190.         }
  191.  
  192.         if (insert7)
  193.         {
  194.             memmove(ptr, insert7, length7 * sizeof(wchar_t));
  195.             error[i].insert7 = ptr;
  196.             ptr += length7;
  197.             *ptr++ = U_NULL;
  198.         }
  199.  
  200.         if (insert8)
  201.         {
  202.             memmove(ptr, insert8, length8 * sizeof(wchar_t));
  203.             error[i].insert8 = ptr;
  204.             ptr += length8;
  205.             *ptr++ = U_NULL;
  206.         }
  207.  
  208.         if (insert9)
  209.         {
  210.             memmove(ptr, insert9, length9 * sizeof(wchar_t));
  211.             error[i].insert9 = ptr;
  212.             ptr += length9;
  213.             *ptr++ = U_NULL;
  214.         }
  215.     }
  216.  
  217.     error[i].num         = i;
  218.     error[i].left_token  = (left_token > right_token ? right_token : left_token);
  219.     error[i].right_token = right_token;
  220.     error[i].right_string_length = lex_stream -> NameStringLength(right_token);
  221.  
  222.     //
  223.     // Dump the error immediately ?
  224.     //
  225.     if (control.option.dump_errors)
  226.     {
  227.         PrintEmacsMessage(i);
  228.  
  229.         if (buffer.Length() > 0)
  230.         {
  231.             delete [] buffer[0];
  232.             buffer.Reset();
  233.         }
  234.         error.Reset(1); // we need at least 1 error in order for the return code to be set properly. See print_messages
  235.         Coutput.flush();
  236.     }
  237.  
  238.     return;
  239. }
  240.  
  241. void SemanticError::StaticInitializer()
  242. {
  243.     memset(warning, 0, _num_kinds * sizeof(bool));
  244.  
  245.     warning[INVALID_OPTION] = 1;
  246.     warning[DISABLED_OPTION] = 1;
  247.     warning[UNSUPPORTED_ENCODING] = 1;
  248.     warning[CANNOT_OPEN_ZIP_FILE] = 1;
  249.     warning[CANNOT_OPEN_PATH_DIRECTORY] = 1;
  250.  
  251.     warning[EMPTY_DECLARATION] = 1;
  252.     warning[REDUNDANT_ABSTRACT] = 1;
  253.     warning[REDUNDANT_FINAL] = 1;
  254.     warning[REDUNDANT_PUBLIC] = 1;
  255.     warning[REDUNDANT_STATIC] = 1;
  256.     warning[OBSOLESCENT_ABSTRACT] = 1;
  257.     warning[OBSOLESCENT_BRACKETS] = 1;
  258.     warning[NO_TYPES] = 1;
  259.     warning[PARENT_TYPE_IN_UNNAMED_PACKAGE] = 1;
  260.  
  261.     warning[DEPRECATED_TYPE] = 1;
  262.     warning[DEPRECATED_FIELD] = 1;
  263.     warning[DEPRECATED_METHOD] = 1;
  264.     warning[DEPRECATED_CONSTRUCTOR] = 1;
  265.  
  266.     warning[UNNECESSARY_TYPE_IMPORT] = 1;
  267.     warning[MULTIPLE_PUBLIC_TYPES] = 1;
  268.     warning[TYPE_IN_MULTIPLE_FILES] = 1;
  269.     warning[MISMATCHED_TYPE_AND_FILE_NAMES] = 1;
  270.     warning[REFERENCE_TO_TYPE_IN_MISMATCHED_FILE] = 1;
  271.     warning[ONE_UNNAMED_PACKAGE] = 1;
  272.     warning[RECOMPILATION] = 1;
  273.     warning[METHOD_WITH_CONSTRUCTOR_NAME] = 1;
  274.  
  275.     warning[DEFAULT_METHOD_NOT_OVERRIDDEN] = 1;
  276.  
  277.     //
  278.     // TODO: Review the cases below. They should be flagged as errors.
  279.     //       However, since javac does not flag them at all, we only issue
  280.     //       a warning.
  281.     warning[STATIC_PROTECTED_FIELD_ACCESS] = 2;
  282.     warning[STATIC_PROTECTED_METHOD_ACCESS] = 2;
  283.     warning[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL] = 2;
  284.     warning[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER] = 2;
  285.     warning[PRIVATE_METHOD_OVERRIDE] = 1;
  286.     warning[PRIVATE_METHOD_OVERRIDE_EXTERNALLY] = 1;
  287.  
  288.     //
  289.     // Something stronger than a warning, but code will be generated anyway
  290.     //
  291.     warning[BAD_INPUT_FILE] = 2;
  292.     warning[UNREADABLE_INPUT_FILE] = 2;
  293.     warning[UNREACHABLE_DEFAULT_CATCH_CLAUSE] = 2;
  294.     warning[ZERO_DIVIDE_CAUTION] = 2;
  295.  
  296. //
  297. // TODO: Let these conditions be flagged as errors now.
  298. //
  299. //    warning[UNREACHABLE_CATCH_CLAUSE] = 2;
  300. //    warning[VARIABLE_NOT_DEFINITELY_ASSIGNED] = 2;
  301. //    warning[TARGET_VARIABLE_IS_FINAL] = 2;
  302. //    warning[FINAL_VARIABLE_TARGET_IN_LOOP] = 2;
  303. //    warning[VOID_TO_STRING] = 2;
  304. //
  305.  
  306. #ifdef TEST
  307.     for (int i = 0; i < _num_kinds; i++)
  308.         print_message[i] = NULL;
  309. #endif
  310.  
  311.     print_message[BAD_ERROR] = PrintBAD_ERROR;
  312.     print_message[DEFAULT_ERROR] = PrintDEFAULT_ERROR;
  313.     print_message[INVALID_OPTION] = PrintINVALID_OPTION;
  314.     print_message[INVALID_K_OPTION] = PrintINVALID_K_OPTION;
  315.     print_message[INVALID_K_TARGET] = PrintINVALID_K_TARGET;
  316.     print_message[INVALID_TAB_VALUE] = PrintINVALID_TAB_VALUE;
  317.     print_message[INVALID_DIRECTORY] = PrintINVALID_DIRECTORY;
  318.     print_message[UNSUPPORTED_OPTION] = PrintUNSUPPORTED_OPTION;
  319.     print_message[UNSUPPORTED_ENCODING] = PrintUNSUPPORTED_ENCODING;
  320.     print_message[DISABLED_OPTION] = PrintDISABLED_OPTION;
  321.     print_message[NO_CURRENT_DIRECTORY] = PrintNO_CURRENT_DIRECTORY;
  322.     print_message[CANNOT_OPEN_ZIP_FILE] = PrintCANNOT_OPEN_ZIP_FILE;
  323.     print_message[CANNOT_OPEN_PATH_DIRECTORY] = PrintCANNOT_OPEN_PATH_DIRECTORY;
  324.     print_message[PACKAGE_NOT_FOUND] = PrintPACKAGE_NOT_FOUND;
  325.     print_message[CANNOT_OPEN_DIRECTORY] = PrintCANNOT_OPEN_DIRECTORY;
  326.     print_message[BAD_INPUT_FILE] = PrintBAD_INPUT_FILE;
  327.     print_message[UNREADABLE_INPUT_FILE] = PrintUNREADABLE_INPUT_FILE;
  328.     print_message[NON_STANDARD_LIBRARY_TYPE] = PrintNON_STANDARD_LIBRARY_TYPE;
  329.     print_message[LIBRARY_METHOD_NOT_FOUND] = PrintLIBRARY_METHOD_NOT_FOUND;
  330.     print_message[CANNOT_REOPEN_FILE] = PrintCANNOT_REOPEN_FILE;
  331.     print_message[CANNOT_WRITE_FILE] = PrintCANNOT_WRITE_FILE;
  332.     print_message[CONSTANT_POOL_OVERFLOW] = PrintCONSTANT_POOL_OVERFLOW;
  333.     print_message[INTERFACES_OVERFLOW] = PrintINTERFACES_OVERFLOW;
  334.     print_message[METHODS_OVERFLOW] = PrintMETHODS_OVERFLOW;
  335.     print_message[STRING_OVERFLOW] = PrintSTRING_OVERFLOW;
  336.     print_message[PARAMETER_OVERFLOW] = PrintPARAMETER_OVERFLOW;
  337.     print_message[ARRAY_OVERFLOW] = PrintARRAY_OVERFLOW;
  338.     print_message[FIELDS_OVERFLOW] = PrintFIELDS_OVERFLOW;
  339.     print_message[LOCAL_VARIABLES_OVERFLOW] = PrintLOCAL_VARIABLES_OVERFLOW;
  340.     print_message[STACK_OVERFLOW] = PrintSTACK_OVERFLOW;
  341.     print_message[CODE_OVERFLOW] = PrintCODE_OVERFLOW;
  342.     print_message[CANNOT_COMPUTE_COLUMNS] = PrintCANNOT_COMPUTE_COLUMNS;
  343.     print_message[EMPTY_DECLARATION] = PrintEMPTY_DECLARATION;
  344.     print_message[REDUNDANT_ABSTRACT] = PrintREDUNDANT_ABSTRACT;
  345.     print_message[REDUNDANT_FINAL] = PrintREDUNDANT_FINAL;
  346.     print_message[REDUNDANT_PUBLIC] = PrintREDUNDANT_PUBLIC;
  347.     print_message[REDUNDANT_STATIC] = PrintREDUNDANT_STATIC;
  348.     print_message[OBSOLESCENT_ABSTRACT] = PrintOBSOLESCENT_ABSTRACT;
  349.     print_message[OBSOLESCENT_BRACKETS] = PrintOBSOLESCENT_BRACKETS;
  350.     print_message[NO_TYPES] = PrintNO_TYPES;
  351.     print_message[MULTIPLE_PUBLIC_TYPES] = PrintMULTIPLE_PUBLIC_TYPES;
  352.     print_message[TYPE_IN_MULTIPLE_FILES] = PrintTYPE_IN_MULTIPLE_FILES;
  353.     print_message[PACKAGE_TYPE_CONFLICT] = PrintPACKAGE_TYPE_CONFLICT;
  354.     print_message[DIRECTORY_FILE_CONFLICT] = PrintDIRECTORY_FILE_CONFLICT;
  355.     print_message[FILE_FILE_CONFLICT] = PrintFILE_FILE_CONFLICT;
  356.     print_message[MISMATCHED_TYPE_AND_FILE_NAMES] = PrintMISMATCHED_TYPE_AND_FILE_NAMES;
  357.     print_message[REFERENCE_TO_TYPE_IN_MISMATCHED_FILE] = PrintREFERENCE_TO_TYPE_IN_MISMATCHED_FILE;
  358.     print_message[DUPLICATE_INNER_TYPE_NAME] = PrintDUPLICATE_INNER_TYPE_NAME;
  359.     print_message[DUPLICATE_TYPE_DECLARATION] = PrintDUPLICATE_TYPE_DECLARATION;
  360.     print_message[UNNECESSARY_TYPE_IMPORT] = PrintUNNECESSARY_TYPE_IMPORT;
  361.     print_message[DUPLICATE_ACCESS_MODIFIER] = PrintDUPLICATE_ACCESS_MODIFIER;
  362.     print_message[DUPLICATE_MODIFIER] = PrintDUPLICATE_MODIFIER;
  363.     print_message[FINAL_ABSTRACT_CLASS] = PrintFINAL_ABSTRACT_CLASS;
  364.     print_message[VOLATILE_FINAL] = PrintVOLATILE_FINAL;
  365.     print_message[FINAL_VOLATILE] = PrintFINAL_VOLATILE;
  366.     print_message[INVALID_TOP_LEVEL_CLASS_MODIFIER] = PrintINVALID_TOP_LEVEL_CLASS_MODIFIER;
  367.     print_message[INVALID_INNER_CLASS_MODIFIER] = PrintINVALID_INNER_CLASS_MODIFIER;
  368.     print_message[INVALID_STATIC_INNER_CLASS_MODIFIER] = PrintINVALID_STATIC_INNER_CLASS_MODIFIER;
  369.     print_message[INVALID_LOCAL_CLASS_MODIFIER] = PrintINVALID_LOCAL_CLASS_MODIFIER;
  370.     print_message[INVALID_INTERFACE_MODIFIER] = PrintINVALID_INTERFACE_MODIFIER;
  371.     print_message[INVALID_FIELD_MODIFIER] = PrintINVALID_FIELD_MODIFIER;
  372.     print_message[INVALID_LOCAL_MODIFIER] = PrintINVALID_LOCAL_MODIFIER;
  373.     print_message[INVALID_METHOD_MODIFIER] = PrintINVALID_METHOD_MODIFIER;
  374.     print_message[INVALID_SIGNATURE_MODIFIER] = PrintINVALID_SIGNATURE_MODIFIER;
  375.     print_message[INVALID_CONSTRUCTOR_MODIFIER] = PrintINVALID_CONSTRUCTOR_MODIFIER;
  376.     print_message[INVALID_CONSTANT_MODIFIER] = PrintINVALID_CONSTANT_MODIFIER;
  377.     print_message[UNINITIALIZED_FIELD] = PrintUNINITIALIZED_FIELD;
  378.     print_message[PARENT_TYPE_IN_UNNAMED_PACKAGE] = PrintPARENT_TYPE_IN_UNNAMED_PACKAGE;
  379.     print_message[RECOMPILATION] = PrintRECOMPILATION;
  380.     print_message[TYPE_NOT_FOUND] = PrintTYPE_NOT_FOUND;
  381.     print_message[DUPLICATE_ON_DEMAND_IMPORT] = PrintDUPLICATE_ON_DEMAND_IMPORT;
  382.     print_message[NOT_A_TYPE] = PrintNOT_A_TYPE;
  383.     print_message[NOT_A_CLASS] = PrintNOT_A_CLASS;
  384.     print_message[NOT_AN_INTERFACE] = PrintNOT_AN_INTERFACE;
  385.     print_message[SUPER_IS_FINAL] = PrintSUPER_IS_FINAL;
  386.     print_message[OBJECT_WITH_SUPER_TYPE] = PrintOBJECT_WITH_SUPER_TYPE;
  387.     print_message[OBJECT_HAS_NO_SUPER_TYPE] = PrintOBJECT_HAS_NO_SUPER_TYPE;
  388.     print_message[DUPLICATE_FIELD] = PrintDUPLICATE_FIELD;
  389.     print_message[DUPLICATE_METHOD] = PrintDUPLICATE_METHOD;
  390.     print_message[DUPLICATE_CONSTRUCTOR] = PrintDUPLICATE_CONSTRUCTOR;
  391.     print_message[MISMATCHED_INHERITED_METHOD] = PrintMISMATCHED_INHERITED_METHOD;
  392.     print_message[MISMATCHED_INHERITED_METHOD_EXTERNALLY] = PrintMISMATCHED_INHERITED_METHOD_EXTERNALLY;
  393.     print_message[DUPLICATE_FORMAL_PARAMETER] = PrintDUPLICATE_FORMAL_PARAMETER;
  394.     print_message[MISMATCHED_CONSTRUCTOR_NAME] = PrintMISMATCHED_CONSTRUCTOR_NAME;
  395.     print_message[METHOD_WITH_CONSTRUCTOR_NAME] = PrintMETHOD_WITH_CONSTRUCTOR_NAME;
  396.     print_message[DUPLICATE_LOCAL_VARIABLE_DECLARATION] = PrintDUPLICATE_LOCAL_VARIABLE_DECLARATION;
  397.     print_message[DUPLICATE_LOCAL_TYPE_DECLARATION] = PrintDUPLICATE_LOCAL_TYPE_DECLARATION;
  398.     print_message[MULTIPLE_DEFAULT_LABEL] = PrintMULTIPLE_DEFAULT_LABEL;
  399.     print_message[UNDECLARED_LABEL] = PrintUNDECLARED_LABEL;
  400.     print_message[DUPLICATE_LABEL] = PrintDUPLICATE_LABEL;
  401.     print_message[CATCH_PRIMITIVE_TYPE] = PrintCATCH_PRIMITIVE_TYPE;
  402.     print_message[CATCH_ARRAY_TYPE] = PrintCATCH_ARRAY_TYPE;
  403.     print_message[AMBIGUOUS_FIELD] = PrintAMBIGUOUS_FIELD;
  404.     print_message[AMBIGUOUS_TYPE] = PrintAMBIGUOUS_TYPE;
  405.     print_message[FIELD_IS_TYPE] = PrintFIELD_IS_TYPE;
  406.     print_message[FIELD_NOT_FOUND] = PrintFIELD_NOT_FOUND;
  407.     print_message[FIELD_NAME_MISSPELLED] = PrintFIELD_NAME_MISSPELLED;
  408.     print_message[FIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE] = PrintFIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE;
  409.     print_message[FIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE] = PrintFIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE;
  410.     print_message[NAME_NOT_FOUND] = PrintNAME_NOT_FOUND;
  411.     print_message[METHOD_NOT_FIELD] = PrintMETHOD_NOT_FIELD;
  412.     print_message[NAME_NOT_YET_AVAILABLE] = PrintNAME_NOT_YET_AVAILABLE;
  413.     print_message[NAME_NOT_VARIABLE] = PrintNAME_NOT_VARIABLE;
  414.     print_message[NAME_NOT_CLASS_VARIABLE] = PrintNAME_NOT_CLASS_VARIABLE;
  415.     print_message[NOT_A_NUMERIC_VARIABLE] = PrintNOT_A_NUMERIC_VARIABLE;
  416.     print_message[METHOD_NOT_FOUND] = PrintMETHOD_NOT_FOUND;
  417.     print_message[METHOD_NAME_NOT_FOUND_IN_TYPE] = PrintMETHOD_NAME_NOT_FOUND_IN_TYPE;
  418.     print_message[METHOD_NAME_MISSPELLED] = PrintMETHOD_NAME_MISSPELLED;
  419.     print_message[METHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE] = PrintMETHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE;
  420.     print_message[METHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE] = PrintMETHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE;
  421.     print_message[HIDDEN_METHOD_IN_ENCLOSING_CLASS] = PrintHIDDEN_METHOD_IN_ENCLOSING_CLASS;
  422.     print_message[FIELD_NOT_METHOD] = PrintFIELD_NOT_METHOD;
  423.     print_message[TYPE_NOT_METHOD] = PrintTYPE_NOT_METHOD;
  424.     print_message[TYPE_NOT_FIELD] = PrintTYPE_NOT_FIELD;
  425.     print_message[METHOD_NOT_CLASS_METHOD] = PrintMETHOD_NOT_CLASS_METHOD;
  426.     print_message[AMBIGUOUS_CONSTRUCTOR_INVOCATION] = PrintAMBIGUOUS_CONSTRUCTOR_INVOCATION;
  427.     print_message[AMBIGUOUS_METHOD_INVOCATION] = PrintAMBIGUOUS_METHOD_INVOCATION;
  428.     print_message[CONSTRUCTOR_NOT_FOUND] = PrintCONSTRUCTOR_NOT_FOUND;
  429.     print_message[METHOD_FOUND_FOR_CONSTRUCTOR] = PrintMETHOD_FOUND_FOR_CONSTRUCTOR;
  430.     print_message[ABSTRACT_TYPE_CREATION] = PrintABSTRACT_TYPE_CREATION;
  431.     print_message[INVALID_INSTANCEOF_CONVERSION] = PrintINVALID_INSTANCEOF_CONVERSION;
  432.     print_message[INVALID_CAST_CONVERSION] = PrintINVALID_CAST_CONVERSION;
  433.     print_message[INVALID_CAST_TYPE] = PrintINVALID_CAST_TYPE;
  434.     print_message[INCOMPATIBLE_TYPE_FOR_INITIALIZATION] = PrintINCOMPATIBLE_TYPE_FOR_INITIALIZATION;
  435.     print_message[INCOMPATIBLE_TYPE_FOR_ASSIGNMENT] = PrintINCOMPATIBLE_TYPE_FOR_ASSIGNMENT;
  436.     print_message[INCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION] = PrintINCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION;
  437.     print_message[INCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION] = PrintINCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION;
  438.     print_message[VOID_ARRAY] = PrintVOID_ARRAY;
  439.     print_message[VOID_TYPE_IN_EQUALITY_EXPRESSION] = PrintVOID_TYPE_IN_EQUALITY_EXPRESSION;
  440.     print_message[TYPE_NOT_THROWABLE] = PrintTYPE_NOT_THROWABLE;
  441.     print_message[TYPE_NOT_PRIMITIVE] = PrintTYPE_NOT_PRIMITIVE;
  442.     print_message[TYPE_NOT_INTEGRAL] = PrintTYPE_NOT_INTEGRAL;
  443.     print_message[TYPE_NOT_NUMERIC] = PrintTYPE_NOT_NUMERIC;
  444.     print_message[TYPE_NOT_INTEGER] = PrintTYPE_NOT_INTEGER;
  445.     print_message[TYPE_NOT_BOOLEAN] = PrintTYPE_NOT_BOOLEAN;
  446.     print_message[TYPE_NOT_ARRAY] = PrintTYPE_NOT_ARRAY;
  447.     print_message[TYPE_NOT_REFERENCE] = PrintTYPE_NOT_REFERENCE;
  448.     print_message[TYPE_NOT_VALID_FOR_SWITCH] = PrintTYPE_NOT_VALID_FOR_SWITCH;
  449.     print_message[TYPE_IS_VOID] = PrintTYPE_IS_VOID;
  450.     print_message[VALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE] = PrintVALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE;
  451.     print_message[TYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE] = PrintTYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE;
  452.     print_message[DUPLICATE_CASE_VALUE] = PrintDUPLICATE_CASE_VALUE;
  453.     print_message[MISPLACED_THIS_EXPRESSION] = PrintMISPLACED_THIS_EXPRESSION;
  454.     print_message[MISPLACED_SUPER_EXPRESSION] = PrintMISPLACED_SUPER_EXPRESSION;
  455.     print_message[TARGET_VARIABLE_IS_FINAL] = PrintTARGET_VARIABLE_IS_FINAL;
  456.     print_message[FINAL_VARIABLE_TARGET_IN_LOOP] = PrintFINAL_VARIABLE_TARGET_IN_LOOP;
  457.     print_message[UNINITIALIZED_FINAL_VARIABLE] = PrintUNINITIALIZED_FINAL_VARIABLE;
  458.     print_message[UNINITIALIZED_STATIC_FINAL_VARIABLE] = PrintUNINITIALIZED_STATIC_FINAL_VARIABLE;
  459.     print_message[UNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR] = PrintUNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR;
  460.     print_message[INIT_SCALAR_WITH_ARRAY] = PrintINIT_SCALAR_WITH_ARRAY;
  461.     print_message[INIT_ARRAY_WITH_SCALAR] = PrintINIT_ARRAY_WITH_SCALAR;
  462.     print_message[INVALID_BYTE_VALUE] = PrintINVALID_BYTE_VALUE;
  463.     print_message[INVALID_SHORT_VALUE] = PrintINVALID_SHORT_VALUE;
  464.     print_message[INVALID_CHARACTER_VALUE] = PrintINVALID_CHARACTER_VALUE;
  465.     print_message[INVALID_INT_VALUE] = PrintINVALID_INT_VALUE;
  466.     print_message[INVALID_LONG_VALUE] = PrintINVALID_LONG_VALUE;
  467.     print_message[INVALID_FLOAT_VALUE] = PrintINVALID_FLOAT_VALUE;
  468.     print_message[INVALID_DOUBLE_VALUE] = PrintINVALID_DOUBLE_VALUE;
  469.     print_message[INVALID_STRING_VALUE] = PrintINVALID_STRING_VALUE;
  470.     print_message[RETURN_STATEMENT_IN_INITIALIZER] = PrintRETURN_STATEMENT_IN_INITIALIZER;
  471.     print_message[MISPLACED_RETURN_WITH_EXPRESSION] = PrintMISPLACED_RETURN_WITH_EXPRESSION;
  472.     print_message[MISPLACED_RETURN_WITH_NO_EXPRESSION] = PrintMISPLACED_RETURN_WITH_NO_EXPRESSION;
  473.     print_message[MISMATCHED_RETURN_AND_METHOD_TYPE] = PrintMISMATCHED_RETURN_AND_METHOD_TYPE;
  474.     print_message[EXPRESSION_NOT_THROWABLE] = PrintEXPRESSION_NOT_THROWABLE;
  475.     print_message[BAD_THROWABLE_EXPRESSION_IN_TRY] = PrintBAD_THROWABLE_EXPRESSION_IN_TRY;
  476.     print_message[BAD_THROWABLE_EXPRESSION_IN_METHOD] = PrintBAD_THROWABLE_EXPRESSION_IN_METHOD;
  477.     print_message[BAD_THROWABLE_EXPRESSION] = PrintBAD_THROWABLE_EXPRESSION;
  478.     print_message[MISPLACED_BREAK_STATEMENT] = PrintMISPLACED_BREAK_STATEMENT;
  479.     print_message[MISPLACED_CONTINUE_STATEMENT] = PrintMISPLACED_CONTINUE_STATEMENT;
  480.     print_message[MISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintMISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION;
  481.     print_message[INVALID_CONTINUE_TARGET] = PrintINVALID_CONTINUE_TARGET;
  482.     print_message[NON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD;
  483.     print_message[NON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD;
  484.     print_message[NON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS] = PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS;
  485.     print_message[NON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD] = PrintNON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD;
  486.     print_message[NO_ABSTRACT_METHOD_IMPLEMENTATION] = PrintNO_ABSTRACT_METHOD_IMPLEMENTATION;
  487.     print_message[DUPLICATE_INTERFACE] = PrintDUPLICATE_INTERFACE;
  488.     print_message[UNKNOWN_QUALIFIED_NAME_BASE] = PrintUNKNOWN_QUALIFIED_NAME_BASE;
  489.     print_message[UNKNOWN_AMBIGUOUS_NAME] = PrintUNKNOWN_AMBIGUOUS_NAME;
  490.     print_message[CIRCULAR_INTERFACE] = PrintCIRCULAR_INTERFACE;
  491.     print_message[CIRCULAR_CLASS] = PrintCIRCULAR_CLASS;
  492.     print_message[TYPE_NOT_ACCESSIBLE] = PrintTYPE_NOT_ACCESSIBLE;
  493.     print_message[PRIVATE_FIELD_NOT_ACCESSIBLE] = PrintPRIVATE_FIELD_NOT_ACCESSIBLE;
  494.     print_message[PROTECTED_FIELD_NOT_ACCESSIBLE] = PrintPROTECTED_FIELD_NOT_ACCESSIBLE;
  495.     print_message[DEFAULT_FIELD_NOT_ACCESSIBLE] = PrintDEFAULT_FIELD_NOT_ACCESSIBLE;
  496.     print_message[PRIVATE_METHOD_NOT_ACCESSIBLE] = PrintPRIVATE_METHOD_NOT_ACCESSIBLE;
  497.     print_message[PROTECTED_METHOD_NOT_ACCESSIBLE] = PrintPROTECTED_METHOD_NOT_ACCESSIBLE;
  498.     print_message[DEFAULT_METHOD_NOT_ACCESSIBLE] = PrintDEFAULT_METHOD_NOT_ACCESSIBLE;
  499.     print_message[PRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintPRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE;
  500.     print_message[PROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintPROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE;
  501.     print_message[DEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE] = PrintDEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE;
  502.     print_message[CONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION] = PrintCONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION;
  503.     print_message[CONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION] = PrintCONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION;
  504.     print_message[PARAMETER_REDECLARED] = PrintPARAMETER_REDECLARED;
  505.     print_message[BAD_ABSTRACT_METHOD_MODIFIER] = PrintBAD_ABSTRACT_METHOD_MODIFIER;
  506.     print_message[ABSTRACT_METHOD_MODIFIER_CONFLICT] = PrintABSTRACT_METHOD_MODIFIER_CONFLICT;
  507.     print_message[ABSTRACT_METHOD_INVOCATION] = PrintABSTRACT_METHOD_INVOCATION;
  508.     print_message[FINAL_METHOD_OVERRIDE] = PrintFINAL_METHOD_OVERRIDE;
  509.     print_message[FINAL_METHOD_OVERRIDE_EXTERNALLY] = PrintFINAL_METHOD_OVERRIDE_EXTERNALLY;
  510.     print_message[PRIVATE_METHOD_OVERRIDE] = PrintPRIVATE_METHOD_OVERRIDE;
  511.     print_message[PRIVATE_METHOD_OVERRIDE_EXTERNALLY] = PrintPRIVATE_METHOD_OVERRIDE_EXTERNALLY;
  512.     print_message[INSTANCE_METHOD_OVERRIDE] = PrintINSTANCE_METHOD_OVERRIDE;
  513.     print_message[INSTANCE_METHOD_OVERRIDE_EXTERNALLY] = PrintINSTANCE_METHOD_OVERRIDE_EXTERNALLY;
  514.     print_message[CLASS_METHOD_OVERRIDE] = PrintCLASS_METHOD_OVERRIDE;
  515.     print_message[CLASS_METHOD_OVERRIDE_EXTERNALLY] = PrintCLASS_METHOD_OVERRIDE_EXTERNALLY;
  516.     print_message[MISMATCHED_OVERRIDDEN_EXCEPTION] = PrintMISMATCHED_OVERRIDDEN_EXCEPTION;
  517.     print_message[MISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY] = PrintMISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY;
  518.     print_message[ABSTRACT_METHOD_WITH_BODY] = PrintABSTRACT_METHOD_WITH_BODY;
  519.     print_message[NON_ABSTRACT_METHOD_WITHOUT_BODY] = PrintNON_ABSTRACT_METHOD_WITHOUT_BODY;
  520.     print_message[BAD_ACCESS_METHOD_OVERRIDE] = PrintBAD_ACCESS_METHOD_OVERRIDE;
  521.     print_message[BAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY] = PrintBAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY;
  522.     print_message[STATIC_OVERRIDE_ABSTRACT] = PrintSTATIC_OVERRIDE_ABSTRACT;
  523.     print_message[STATIC_OVERRIDE_ABSTRACT_EXTERNALLY] = PrintSTATIC_OVERRIDE_ABSTRACT_EXTERNALLY;
  524.     print_message[CIRCULAR_THIS_CALL] = PrintCIRCULAR_THIS_CALL;
  525.     print_message[INSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  526.     print_message[INSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  527.     print_message[SYNTHETIC_VARIABLE_ACCESS] = PrintSYNTHETIC_VARIABLE_ACCESS;
  528.     print_message[SYNTHETIC_METHOD_INVOCATION] = PrintSYNTHETIC_METHOD_INVOCATION;
  529.     print_message[SYNTHETIC_CONSTRUCTOR_INVOCATION] = PrintSYNTHETIC_CONSTRUCTOR_INVOCATION;
  530.     print_message[THIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintTHIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  531.     print_message[SUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintSUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  532.     print_message[INNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION] = PrintINNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION;
  533.     print_message[EXPRESSION_NOT_CONSTANT] = PrintEXPRESSION_NOT_CONSTANT;
  534.     print_message[UNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION] = PrintUNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION;
  535.     print_message[UNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION] = PrintUNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION;
  536.     print_message[UNREACHABLE_CATCH_CLAUSE] = PrintUNREACHABLE_CATCH_CLAUSE;
  537.     print_message[UNREACHABLE_DEFAULT_CATCH_CLAUSE] = PrintUNREACHABLE_DEFAULT_CATCH_CLAUSE;
  538.     print_message[UNREACHABLE_STATEMENT] = PrintUNREACHABLE_STATEMENT;
  539.     print_message[UNREACHABLE_STATEMENTS] = PrintUNREACHABLE_STATEMENTS;
  540.     print_message[UNREACHABLE_CONSTRUCTOR_BODY] = PrintUNREACHABLE_CONSTRUCTOR_BODY;
  541.     print_message[BLOCKED_CATCH_CLAUSE] = PrintBLOCKED_CATCH_CLAUSE;
  542.     print_message[VARIABLE_NOT_DEFINITELY_ASSIGNED] = PrintVARIABLE_NOT_DEFINITELY_ASSIGNED;
  543.     print_message[TYPED_METHOD_WITH_NO_RETURN] = PrintTYPED_METHOD_WITH_NO_RETURN;
  544.  
  545.     print_message[DEFAULT_METHOD_NOT_OVERRIDDEN] = PrintDEFAULT_METHOD_NOT_OVERRIDDEN;
  546.  
  547.     print_message[ONE_UNNAMED_PACKAGE] = PrintONE_UNNAMED_PACKAGE;
  548.     print_message[TYPE_NOT_IN_UNNAMED_PACKAGE] = PrintTYPE_NOT_IN_UNNAMED_PACKAGE;
  549.     print_message[TYPE_IN_WRONG_PACKAGE] = PrintTYPE_IN_WRONG_PACKAGE;
  550.     print_message[TYPE_NAME_MISMATCH] = PrintTYPE_NAME_MISMATCH;
  551.  
  552.     print_message[DEPRECATED_TYPE] = PrintDEPRECATED_TYPE;
  553.     print_message[DEPRECATED_FIELD] = PrintDEPRECATED_FIELD;
  554.     print_message[DEPRECATED_METHOD] = PrintDEPRECATED_METHOD;
  555.     print_message[DEPRECATED_CONSTRUCTOR] = PrintDEPRECATED_CONSTRUCTOR;
  556.  
  557.     print_message[COMPRESSED_ZIP_FILE] = PrintCOMPRESSED_ZIP_FILE;
  558.     print_message[INVALID_CLASS_FILE] = PrintINVALID_CLASS_FILE;
  559.     print_message[CANNOT_OPEN_CLASS_FILE] = PrintCANNOT_OPEN_CLASS_FILE;
  560.  
  561.     print_message[STATIC_NOT_INNER_CLASS] = PrintSTATIC_NOT_INNER_CLASS;
  562.     print_message[TYPE_NOT_INNER_CLASS] = PrintTYPE_NOT_INNER_CLASS;
  563.     print_message[SUPER_TYPE_NOT_INNER_CLASS] = PrintSUPER_TYPE_NOT_INNER_CLASS;
  564.     print_message[STATIC_FIELD_IN_INNER_CLASS] = PrintSTATIC_FIELD_IN_INNER_CLASS;
  565.     print_message[STATIC_METHOD_IN_INNER_CLASS] = PrintSTATIC_METHOD_IN_INNER_CLASS;
  566.     print_message[STATIC_TYPE_IN_INNER_CLASS] = PrintSTATIC_TYPE_IN_INNER_CLASS;
  567.     print_message[STATIC_INITIALIZER_IN_INNER_CLASS] = PrintSTATIC_INITIALIZER_IN_INNER_CLASS;
  568.     print_message[INNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE] = PrintINNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE;
  569.     print_message[STATIC_PROTECTED_FIELD_ACCESS] = PrintSTATIC_PROTECTED_FIELD_ACCESS;
  570.     print_message[STATIC_PROTECTED_METHOD_ACCESS] = PrintSTATIC_PROTECTED_METHOD_ACCESS;
  571.     print_message[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL] = PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL;
  572.     print_message[INHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER] = PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER;
  573.     print_message[ILLEGAL_THIS_FIELD_ACCESS] = PrintILLEGAL_THIS_FIELD_ACCESS;
  574.     print_message[CONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS] = PrintCONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS;
  575.     print_message[ENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION] = PrintENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION;
  576.     print_message[ENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION] = PrintENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION;
  577.     print_message[ENCLOSING_INSTANCE_NOT_ACCESSIBLE] = PrintENCLOSING_INSTANCE_NOT_ACCESSIBLE;
  578.     print_message[INVALID_ENCLOSING_INSTANCE] = PrintINVALID_ENCLOSING_INSTANCE;
  579.     print_message[ZERO_DIVIDE_ERROR] = PrintZERO_DIVIDE_ERROR;
  580.     print_message[ZERO_DIVIDE_CAUTION] = PrintZERO_DIVIDE_CAUTION;
  581.     print_message[VOID_TO_STRING] = PrintVOID_TO_STRING;
  582.  
  583. #ifdef TEST
  584.     //
  585.     // Make sure that there is a message associated with each code
  586.     //
  587.     for (int k = 0; k < _num_kinds; k++)
  588.         assert(print_message[k] != NULL);
  589. #endif
  590. }
  591.  
  592.  
  593. //
  594. // This procedure uses a  quick sort algorithm to sort the ERRORS
  595. // by the left_line_no and left_column_no fields.
  596. //
  597. void SemanticError::SortMessages()
  598. {
  599.      int lower,
  600.          upper,
  601.          lostack[32],
  602.          histack[32];
  603.  
  604.      int top,
  605.          i,
  606.          j;
  607.      ErrorInfo pivot,
  608.                temp;
  609.  
  610.      top = 0;
  611.      lostack[top] = 0;
  612.      histack[top] = error.Length() - 1;
  613.  
  614.      while(top >= 0)
  615.      {
  616.          lower = lostack[top];
  617.          upper = histack[top];
  618.          top--;
  619.  
  620.          while(upper > lower)
  621.          {
  622.              //
  623.              // The array is most-likely almost sorted. Therefore,
  624.              // we use the middle element as the pivot element.
  625.              //
  626.              i = (lower + upper) / 2;
  627.              pivot = error[i];
  628.              error[i] = error[lower];
  629.  
  630.              //
  631.              // Split the array section indicated by LOWER and UPPER
  632.              // using ARRAY(LOWER) as the pivot.
  633.              //
  634.              i = lower;
  635.              for (j = lower + 1; j <= upper; j++)
  636.                  if ((error[j].left_token < pivot.left_token) ||
  637.                  //
  638.                  // When two error messages start in the same location
  639.                  // and one is nested inside the other, the outer one
  640.                  // is placed first so that it can be printed last.
  641.                  // Recall that its right-span location is reached
  642.                  // after the inner one has been completely processed.
  643.                  //
  644.                      (error[j].left_token == pivot.left_token &&
  645.                       error[j].right_token > pivot.right_token) ||
  646.                  //
  647.                  // When two error messages are at the same location
  648.                  // span, check the NUM field to keep the sort stable.
  649.                  // When the location spans only a single symbol,
  650.                  // the one with the lowest "num" is placed first.
  651.                  //
  652.                      (error[j].left_token  == pivot.left_token  &&
  653.                       error[j].right_token == pivot.right_token &&
  654.                       pivot.left_token == pivot.right_token     &&
  655.                       error[j].num < pivot.num)                       ||
  656.                  //
  657.                  // When two error messages are at the same location
  658.                  // which spans more than one symbol in the source,
  659.                  // the first message is treated as being nested into
  660.                  // the second message and (just like the nested case
  661.                  // above) it is placed last in the sorted sequence.
  662.                  //
  663.                      (error[j].left_token  == pivot.left_token  &&
  664.                       error[j].right_token == pivot.right_token &&
  665.                       pivot.left_token < pivot.right_token      &&
  666.                       error[j].num > pivot.num))
  667.                  {
  668.                      temp = error[++i];
  669.                      error[i] = error[j];
  670.                      error[j] = temp;
  671.                  }
  672.              error[lower] = error[i];
  673.              error[i] = pivot;
  674.  
  675.              top++;
  676.              if ((i - lower) < (upper - i))
  677.              {
  678.                  lostack[top] = i + 1;
  679.                  histack[top] = upper;
  680.                  upper = i - 1;
  681.              }
  682.              else
  683.              {
  684.                  histack[top] = i - 1;
  685.                  lostack[top] = lower;
  686.                  lower = i + 1;
  687.              }
  688.          }
  689.      }
  690.  
  691.      return;
  692. }
  693.  
  694.  
  695. //
  696. // This is the local private procedure that prints the semantic error messages.
  697. //
  698. int SemanticError::PrintMessages()
  699. {
  700.     int return_code = (num_errors > 0 ? 1 : 0);
  701.  
  702.     //
  703.     // If the errors have not yet been dumped,...
  704.     //
  705.     if (! control.option.dump_errors)
  706.     {
  707.         if (control.option.errors)
  708.         {
  709.             if (num_errors == 0)
  710.             {
  711.                 if (control.option.nowarn) // we only had warnings and they should not be reported
  712.                     return return_code;
  713.  
  714.                 Coutput << "\nIssued "
  715.                         << num_warnings
  716.                         << (lex_stream -> file_symbol -> semantic == control.system_semantic ? " system" : " semantic")
  717.                         << " warning" << (num_warnings <= 1 ? "" : "s");
  718.             }
  719.             else // we had some errors, and possibly warnings as well
  720.             {
  721.                 Coutput << "\nFound "
  722.                         << num_errors
  723.                         << (lex_stream -> file_symbol -> semantic == control.system_semantic ? " system" : " semantic")
  724.                         << " error" << (num_errors <= 1 ? "" : "s");
  725.                 if (num_warnings > 0 && !control.option.nowarn)
  726.                 {
  727.                      Coutput << " and issued "
  728.                              << num_warnings << " warning" << (num_warnings <= 1 ? "" : "s");
  729.                 }
  730.             }
  731.  
  732.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  733.             {
  734.                 Coutput << " compiling \""
  735.                         << lex_stream -> FileName()
  736.                         << '\"';
  737.             }
  738.             Coutput << ':';
  739.  
  740.             //
  741.             //
  742.             //
  743.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  744.             {
  745.                 lex_stream -> RereadInput();
  746.  
  747.                 if (! lex_stream -> InputBuffer())
  748.                 {
  749.                     char *file_name = lex_stream -> FileName();
  750.                     int length = lex_stream -> FileNameLength();
  751.                     wchar_t *name = new wchar_t[length + 1];
  752.                     for (int i = 0; i < length; i++)
  753.                         name[i] = file_name[i];
  754.                     name[length] = U_NULL;
  755.                     control.system_semantic -> ReportSemError(SemanticError::CANNOT_REOPEN_FILE,
  756.                                                               0,
  757.                                                               0,
  758.                                                               name);
  759.                     delete [] name;
  760.                 }
  761.             }
  762.  
  763.             if (lex_stream -> file_symbol -> semantic == control.system_semantic || lex_stream -> InputBuffer())
  764.             {
  765.                 SortMessages();
  766.                 for (int k = 0; k < error.Length(); k++)
  767.                 {
  768.                     if ((warning[error[k].msg_code] != 1) || (! control.option.nowarn))
  769.                     {
  770.                         if (error[k].left_token < error[k].right_token)
  771.                              PrintLargeSource(k);
  772.                         else PrintSmallSource(k);
  773.                         Coutput << "\n*** " << (warning[error[k].msg_code] == 1
  774.                                                     ? "Warning: "
  775.                                                     : (warning[error[k].msg_code] == 2 && (! control.option.zero_defect)
  776.                                                               ? "Caution: "
  777.                                                               : "Error: "));
  778.                         (print_message[error[k].msg_code]) (error[k], lex_stream, control);
  779.                         Coutput << '\n';
  780.                     }
  781.                 }
  782.                 lex_stream -> DestroyInput();
  783.             }
  784.         }
  785.         else
  786.         {
  787.             if (lex_stream -> file_symbol -> semantic != control.system_semantic)
  788.             {
  789.                 if (! lex_stream -> ComputeColumns())
  790.                 {
  791.                     char *file_name = lex_stream -> FileName();
  792.                     int length = lex_stream -> FileNameLength();
  793.                     wchar_t *name = new wchar_t[length + 1];
  794.                     for (int i = 0; i < length; i++)
  795.                         name[i] = file_name[i];
  796.                     name[length] = U_NULL;
  797.                     control.system_semantic -> ReportSemError(SemanticError::CANNOT_COMPUTE_COLUMNS,
  798.                                                               0,
  799.                                                               0,
  800.                                                               name);
  801.                     delete [] name;
  802.                 }
  803.             }
  804.  
  805.             SortMessages();
  806.             for (int k = 0; k < error.Length(); k++)
  807.             {
  808.                 if ((warning[error[k].msg_code] != 1) || (! control.option.nowarn))
  809.                     PrintEmacsMessage(k);
  810.             }
  811.         }
  812.     }
  813.  
  814.     Coutput.flush();
  815.  
  816.     return return_code;
  817. }
  818.  
  819.  
  820. void SemanticError::PrintEmacsMessage(int k)
  821. {
  822.     int left_line_no    = lex_stream -> Line(error[k].left_token),
  823.         left_column_no  = lex_stream -> Column(error[k].left_token),
  824.         right_line_no   = lex_stream -> Line(error[k].right_token),
  825.         right_column_no = lex_stream -> Column(error[k].right_token);
  826.  
  827.     if (right_column_no != 0) // could not compute a column number
  828.         right_column_no += (error[k].right_string_length - 1); // point to last character in right token
  829.  
  830.     Coutput << lex_stream -> FileName()
  831.             << ':' << left_line_no  << ':' << left_column_no
  832.             << ':' << right_line_no << ':' << right_column_no
  833.             << (warning[error[k].msg_code] == 1
  834.                        ? ": Warning: "
  835.                        : (warning[error[k].msg_code] == 2  && (! control.option.zero_defect)
  836.                                  ? ": Caution: "
  837.                                  : ": Error: "));
  838.     (print_message[error[k].msg_code]) (error[k], lex_stream, control);
  839.     Coutput << '\n';
  840.  
  841.     return;
  842. }
  843.  
  844.  
  845. //
  846. // This procedure is invoked to print a large message that may
  847. // span more than one line. The parameter message points to the
  848. // starting line. The parameter k points to the error message in
  849. // the error structure.
  850. //
  851. void SemanticError::PrintLargeSource(int k)
  852. {
  853.     int left_line_no    = lex_stream -> Line(error[k].left_token),
  854.         left_column_no  = lex_stream -> Column(error[k].left_token),
  855.         right_line_no   = lex_stream -> Line(error[k].right_token),
  856.         right_column_no = lex_stream -> Column(error[k].right_token);
  857.  
  858.     if (left_line_no == right_line_no)
  859.     {
  860.         if (left_line_no == 0)
  861.             Coutput << "\n";
  862.         else
  863.         {
  864.             Coutput << "\n\n";
  865.             Coutput.width(6);
  866.             Coutput << left_line_no << ". ";
  867.             for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  868.                 Coutput << lex_stream -> InputBuffer()[i];
  869.  
  870.             int offset = lex_stream -> WcharOffset(error[k].left_token, error[k].right_token);
  871.             Coutput.width(left_column_no + 8);
  872.             Coutput << "<";
  873.             Coutput.width(right_column_no + error[k].right_string_length - left_column_no - 1 + offset);
  874.             Coutput.fill('-');
  875.             Coutput << ">";
  876.             Coutput.fill(' ');
  877.         }
  878.     }
  879.     else
  880.     {
  881.         Coutput << "\n\n";
  882.         Coutput.width(left_column_no + 8);
  883.         Coutput << "<";
  884.  
  885.         Coutput.width(lex_stream -> LineSegmentLength(error[k].left_token));
  886.         Coutput.fill('-');
  887.         Coutput << "\n";
  888.         Coutput.fill(' ');
  889.  
  890.         Coutput.width(6);
  891.         Coutput << left_line_no << ". ";
  892.         for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  893.             Coutput << lex_stream -> InputBuffer()[i];
  894.  
  895.         if (right_line_no > left_line_no + 1)
  896.         {
  897.             Coutput.width(left_column_no + 7);
  898.             Coutput << " ";
  899.             Coutput << ". . .\n";
  900.         }
  901.  
  902.         Coutput.width(6);
  903.         Coutput << right_line_no << ". ";
  904.         for (int j = lex_stream -> LineStart(right_line_no); j <= lex_stream -> LineEnd(right_line_no); j++)
  905.             Coutput << lex_stream -> InputBuffer()[j];
  906.  
  907.         int offset = lex_stream -> WcharOffset(error[k].right_token);
  908.         Coutput.width(8);
  909.         Coutput << "";
  910.         Coutput.width(right_column_no + error[k].right_string_length - 1 + offset);
  911.         Coutput.fill('-');
  912.         Coutput << ">";
  913.         Coutput.fill(' ');
  914.     }
  915.  
  916.     return;
  917. }
  918.  
  919. //
  920. // This procedure is invoked to print a small message that may
  921. // only span a single line. The parameter k points to the error
  922. // message in the error structure.
  923. //
  924. void SemanticError::PrintSmallSource(int k)
  925. {
  926.     int left_line_no = lex_stream -> Line(error[k].left_token);
  927.  
  928.     if (left_line_no == 0)
  929.         Coutput << "\n";
  930.     else
  931.     {
  932.         Coutput << "\n\n";
  933.         Coutput.width(6);
  934.         Coutput << left_line_no;
  935.         Coutput << ". ";
  936.         for (int i = lex_stream -> LineStart(left_line_no); i <= lex_stream -> LineEnd(left_line_no); i++)
  937.             Coutput << lex_stream -> InputBuffer()[i];
  938.  
  939.         int left_column_no = lex_stream -> Column(error[k].left_token),
  940.             right_column_no = lex_stream -> Column(error[k].right_token);
  941.  
  942.         Coutput.width(left_column_no + 7);
  943.         Coutput << "";
  944.         if (left_column_no == right_column_no && error[k].right_string_length == 1)
  945.             Coutput << '^';
  946.         else
  947.         {
  948.             int offset = lex_stream -> WcharOffset(error[k].left_token, error[k].right_token);
  949.             Coutput << '<';
  950.             Coutput.width(right_column_no + error[k].right_string_length - left_column_no - 1 + offset);
  951.             Coutput.fill('-');
  952.             Coutput << ">";
  953.             Coutput.fill(' ');
  954.         }
  955.     }
  956.  
  957.     return;
  958. }
  959.  
  960.  
  961. //
  962. // These "print_" procedures are invoked to print specific
  963. // error messages. The parameter err identifies the error to
  964. // be processed.
  965. //
  966. void SemanticError::PrintBAD_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  967. {
  968.     fprintf(stderr, "chaos: Error code %i is not a valid error message code.\n", err.msg_code);
  969.  
  970.     return;
  971. }
  972.  
  973.  
  974. void SemanticError::PrintDEFAULT_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  975. {
  976.     if (err.insert1)
  977.         Coutput << err.insert1;
  978.     if (err.insert2)
  979.         Coutput << err.insert2;
  980.     if (err.insert3)
  981.         Coutput << err.insert3;
  982.     if (err.insert4)
  983.         Coutput << err.insert4;
  984.     if (err.insert5)
  985.         Coutput << err.insert5;
  986.     if (err.insert6)
  987.         Coutput << err.insert6;
  988.     if (err.insert7)
  989.         Coutput << err.insert7;
  990.     if (err.insert8)
  991.         Coutput << err.insert8;
  992.     if (err.insert9)
  993.         Coutput << err.insert9;
  994.  
  995.     return;
  996. }
  997.  
  998.  
  999. void SemanticError::PrintINVALID_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1000. {
  1001.     Coutput << '\"'
  1002.             << err.insert1
  1003.             << "\" is an invalid option; "
  1004.             << StringConstant::U8S_command_format
  1005.             << '.';
  1006.  
  1007.     return;
  1008. }
  1009.  
  1010.  
  1011. void SemanticError::PrintINVALID_K_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1012. {
  1013.     Coutput << "No argument specified for +K option. The proper form is \"+Kxxx=xxx\" (with no intervening space).";
  1014.  
  1015.     return;
  1016. }
  1017.  
  1018.  
  1019. void SemanticError::PrintINVALID_K_TARGET(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1020. {
  1021.     Coutput << '\"'
  1022.             << err.insert1
  1023.             << "\" is not a valid target in a +K option. The target must be a numeric type or boolean.";
  1024.  
  1025.     return;
  1026. }
  1027.  
  1028.  
  1029. void SemanticError::PrintINVALID_TAB_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1030. {
  1031.     Coutput << '\"'
  1032.             << err.insert1
  1033.             << "\" is not a valid tab size. An integer value is expected.";
  1034.  
  1035.     return;
  1036. }
  1037.  
  1038.  
  1039. void SemanticError::PrintINVALID_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1040. {
  1041.     Coutput << "The directory specified in the \"-d\" option, \""
  1042.             << err.insert1
  1043.             << "\", is either invalid or it could not be expanded.";
  1044.  
  1045.     return;
  1046. }
  1047.  
  1048.  
  1049. void SemanticError::PrintUNSUPPORTED_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1050. {
  1051.     Coutput << "This option \""
  1052.             << err.insert1
  1053.             << "\" is currently unsupported.";
  1054.  
  1055.     return;
  1056. }
  1057.  
  1058.  
  1059. void SemanticError::PrintDISABLED_OPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1060. {
  1061.     Coutput << "This option \""
  1062.             << err.insert1
  1063.             << "\" has been temporarily disabled.";
  1064.  
  1065.     return;
  1066. }
  1067.  
  1068.  
  1069. void SemanticError::PrintUNSUPPORTED_ENCODING(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1070. {
  1071.     Coutput << "Unsupported encoding: \""
  1072.             << err.insert1
  1073.             << "\".";
  1074.     
  1075.     return;
  1076. }              
  1077.  
  1078. void SemanticError::PrintNO_CURRENT_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1079. {
  1080.     Coutput << "Could not open current directory.";
  1081.  
  1082.     return;
  1083. }
  1084.  
  1085.  
  1086. void SemanticError::PrintCANNOT_OPEN_ZIP_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1087. {
  1088.     Coutput << "The file \""
  1089.             << err.insert1
  1090.             << "\" is not a valid zip file.";
  1091.  
  1092.     return;
  1093. }
  1094.  
  1095.  
  1096. void SemanticError::PrintCANNOT_OPEN_PATH_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1097. {
  1098.     Coutput << "The file \""
  1099.             << err.insert1
  1100.             << "\" is not a valid directory.";
  1101.  
  1102.     return;
  1103. }
  1104.  
  1105.  
  1106. void SemanticError::PrintPACKAGE_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1107. {
  1108.     Coutput << "Could not find package named: \n";
  1109.     for (int i = 1; i < control.classpath.Length(); i++)
  1110.     {
  1111.         PathSymbol *path_symbol = control.classpath[i];
  1112.         wchar_t *path = path_symbol -> Name();
  1113.  
  1114.         Coutput << "                "
  1115.                 << path;
  1116.         if (path_symbol -> IsZip())
  1117.         {
  1118.             Coutput << "("
  1119.                     << err.insert1
  1120.                     << ")";
  1121.         }
  1122.         else
  1123.         {
  1124.             Coutput << "/"
  1125.                     << err.insert1;
  1126.         }
  1127.  
  1128.         if (i + 2 < control.classpath.Length())
  1129.              Coutput << ", \n";
  1130.         else if (i + 2 == control.classpath.Length())
  1131.              Coutput << " or \n";
  1132.     }
  1133.  
  1134.     return;
  1135. }
  1136.  
  1137.  
  1138. void SemanticError::PrintCANNOT_OPEN_DIRECTORY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1139. {
  1140.     Coutput << "Unable to open directory \""
  1141.             << err.insert1
  1142.             << "\".";
  1143.  
  1144.     return;
  1145. }
  1146.  
  1147.  
  1148. void SemanticError::PrintBAD_INPUT_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1149. {
  1150.     Coutput << "The input file \""
  1151.             << err.insert1
  1152.             << "\" does not have the \".java\" extension.";
  1153.  
  1154.     return;
  1155. }
  1156.  
  1157.  
  1158. void SemanticError::PrintUNREADABLE_INPUT_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1159. {
  1160.     Coutput << "The input file \""
  1161.             << err.insert1
  1162.             << "\" was not found.";
  1163.  
  1164.     return;
  1165. }
  1166.  
  1167.  
  1168. void SemanticError::PrintNON_STANDARD_LIBRARY_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1169. {
  1170.     Coutput << "A non-standard version of the type \"";
  1171.     if (NotDot(err.insert1))
  1172.     {
  1173.         Coutput << err.insert1
  1174.                 << "/";
  1175.     }
  1176.     Coutput << err.insert2
  1177.             << "\" was found. Class files that depend on this type may not have been generated.";
  1178.  
  1179.     return;
  1180. }
  1181.  
  1182.  
  1183. void SemanticError::PrintLIBRARY_METHOD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1184. {
  1185.     Coutput << "A class file was not generated for the type \"";
  1186.     if (NotDot(err.insert1))
  1187.     {
  1188.         Coutput << err.insert1
  1189.                 << "/";
  1190.     }
  1191.     Coutput << err.insert2
  1192.             << "\" because a library method that it depends on was not found. See system messages for more information.";
  1193.  
  1194.     return;
  1195. }
  1196.  
  1197.  
  1198. void SemanticError::PrintCANNOT_REOPEN_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1199. {
  1200.     Coutput << "Unable to reopen file \""
  1201.             << err.insert1
  1202.             << "\".";
  1203.  
  1204.     return;
  1205. }
  1206.  
  1207.  
  1208. void SemanticError::PrintCANNOT_WRITE_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1209. {
  1210.     Coutput << "Unable to write file \""
  1211.             << err.insert1
  1212.             << "\".";
  1213.  
  1214.     return;
  1215. }
  1216.  
  1217.  
  1218. void SemanticError::PrintCONSTANT_POOL_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1219. {
  1220.     Coutput << "Processing of this type, \"";
  1221.     if (NotDot(err.insert1))
  1222.     {
  1223.         Coutput << err.insert1
  1224.                 << "/";
  1225.     }
  1226.     Coutput << err.insert2
  1227.             << "\", produced a constant pool that exceeded the limit of 65535 elements.";
  1228.  
  1229.     return;
  1230. }
  1231.  
  1232.  
  1233. void SemanticError::PrintINTERFACES_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1234. {
  1235.     Coutput << "The type \"";
  1236.     if (NotDot(err.insert1))
  1237.     {
  1238.         Coutput << err.insert1
  1239.                 << "/";
  1240.     }
  1241.     Coutput << err.insert2
  1242.             << "\" implements more than 65535 interfaces.";
  1243.  
  1244.     return;
  1245. }
  1246.  
  1247.  
  1248. void SemanticError::PrintMETHODS_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1249. {
  1250.     Coutput << "The type \"";
  1251.     if (NotDot(err.insert1))
  1252.     {
  1253.         Coutput << err.insert1
  1254.                 << "/";
  1255.     }
  1256.     Coutput << err.insert2
  1257.             << "\" contains more than 65535 methods.";
  1258.  
  1259.     return;
  1260. }
  1261.  
  1262.  
  1263. void SemanticError::PrintSTRING_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1264. {
  1265.     Coutput << "The type \"";
  1266.     if (NotDot(err.insert1))
  1267.     {
  1268.         Coutput << err.insert1
  1269.                 << "/";
  1270.     }
  1271.     Coutput << err.insert2
  1272.             << "\" generated one or more strings whose length exceeds the maximum length of 65535 Utf8 chacracters.";
  1273.  
  1274.     return;
  1275. }
  1276.  
  1277.  
  1278. void SemanticError::PrintPARAMETER_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1279. {
  1280.     Coutput << "Method \""
  1281.             << err.insert1
  1282.             << "\" in type \"";
  1283.     if (NotDot(err.insert2))
  1284.     {
  1285.         Coutput << err.insert2
  1286.                 << "/";
  1287.     }
  1288.     Coutput << err.insert3
  1289.             << "\" contains more than 255 formal parameters. Note that a parameter of type long or double counts as 2 parameters.";
  1290.  
  1291.     return;
  1292. }
  1293.  
  1294.  
  1295. void SemanticError::PrintARRAY_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1296. {
  1297.     Coutput << "The number of dimensions in an array is limited to 255.";
  1298.  
  1299.     return;
  1300. }
  1301.  
  1302.  
  1303. void SemanticError::PrintFIELDS_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1304. {
  1305.     Coutput << "The type \"";
  1306.     if (NotDot(err.insert1))
  1307.     {
  1308.         Coutput << err.insert1
  1309.                 << "/";
  1310.     }
  1311.     Coutput << err.insert2
  1312.             << "\" contains more than 65535 fields.";
  1313.  
  1314.     return;
  1315. }
  1316.  
  1317.  
  1318. void SemanticError::PrintLOCAL_VARIABLES_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1319. {
  1320.     Coutput << "Method \""
  1321.             << err.insert1
  1322.             << "\" in type \"";
  1323.     if (NotDot(err.insert2))
  1324.     {
  1325.         Coutput << err.insert2
  1326.                 << "/";
  1327.     }
  1328.     Coutput << err.insert3
  1329.             << "\" contains more than 65535 local variables.";
  1330.  
  1331.     return;
  1332. }
  1333.  
  1334.  
  1335. void SemanticError::PrintSTACK_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1336. {
  1337.     Coutput << "Processing of the method or constructor \""
  1338.             << err.insert1
  1339.             << "\" in type \"";
  1340.     if (NotDot(err.insert2))
  1341.     {
  1342.         Coutput << err.insert2
  1343.                 << "/";
  1344.     }
  1345.     Coutput << err.insert3
  1346.             << "\" requires a stack that exceeds the maximum limit of 65535.";
  1347.  
  1348.     return;
  1349. }
  1350.  
  1351.  
  1352. void SemanticError::PrintCODE_OVERFLOW(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1353. {
  1354.     Coutput << "Processing of the method or constructor \""
  1355.             << err.insert1
  1356.             << "\" in type \"";
  1357.     if (NotDot(err.insert2))
  1358.     {
  1359.         Coutput << err.insert2
  1360.                 << "/";
  1361.     }
  1362.     Coutput << err.insert3
  1363.             << "\" produced a code attribute that exceeds the code limit of 65535 elements.";
  1364.  
  1365.     return;
  1366. }
  1367.  
  1368.  
  1369. void SemanticError::PrintCANNOT_COMPUTE_COLUMNS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1370. {
  1371.     Coutput << "Unable to reopen file \""
  1372.             << err.insert1
  1373.             << "\". Therefore, column positions may be incorrect.";
  1374.  
  1375.     return;
  1376. }
  1377.  
  1378.  
  1379. void SemanticError::PrintREDUNDANT_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1380. {
  1381.     Coutput << "The use of the \"abstract\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1382.  
  1383.     return;
  1384. }
  1385.  
  1386.  
  1387. void SemanticError::PrintREDUNDANT_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1388. {
  1389.     Coutput << "The use of the \"final\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1390.  
  1391.     return;
  1392. }
  1393.  
  1394.  
  1395. void SemanticError::PrintREDUNDANT_PUBLIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1396. {
  1397.     Coutput << "The use of the \"public\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1398.  
  1399.     return;
  1400. }
  1401.  
  1402.  
  1403. void SemanticError::PrintREDUNDANT_STATIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1404. {
  1405.     Coutput << "The use of the \"static\" modifier in this context is redundant and strongly discouraged as a matter of style.";
  1406.  
  1407.     return;
  1408. }
  1409.  
  1410.  
  1411. void SemanticError::PrintEMPTY_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1412. {
  1413.     Coutput << "An EmptyDeclaration is a deprecated feature that should not be used - \";\" ignored.";
  1414.  
  1415.     return;
  1416. }
  1417.  
  1418.  
  1419. void SemanticError::PrintOBSOLESCENT_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1420. {
  1421.     Coutput << "Every interface in implicitly abstract. This modifier is obsolete and should not be used in new Java programs.";
  1422.  
  1423.     return;
  1424. }
  1425.  
  1426.  
  1427. void SemanticError::PrintOBSOLESCENT_BRACKETS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1428. {
  1429.     Coutput << "The use of empty bracket pairs following a MethodDeclarator should not be used in new Java programs.";
  1430.  
  1431.     return;
  1432. }
  1433.  
  1434.  
  1435. void SemanticError::PrintNO_TYPES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1436. {
  1437.     Coutput << "This compilation unit contains no type declaration.";
  1438.  
  1439.     return;
  1440. }
  1441.  
  1442.  
  1443. void SemanticError::PrintTYPE_IN_MULTIPLE_FILES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1444. {
  1445.     Coutput << "The file \"";
  1446.     if (NotDot(err.insert1))
  1447.     {
  1448.         Coutput << err.insert1
  1449.                 << "/";
  1450.     }
  1451.     Coutput << err.insert2
  1452.             << ".java\" contains type \""
  1453.             << err.insert4
  1454.             << "\" which conflicts with file \"";
  1455.     if (NotDot(err.insert3))
  1456.     {
  1457.         Coutput << err.insert3
  1458.                 << "/";
  1459.     }
  1460.     Coutput << err.insert4
  1461.             << ".java\".";
  1462.  
  1463.     return;
  1464. }
  1465.  
  1466.  
  1467. void SemanticError::PrintPACKAGE_TYPE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1468. {
  1469.     Coutput << "The type \"";
  1470.     if (NotDot(err.insert1))
  1471.     {
  1472.         Coutput << err.insert1
  1473.                 << "/";
  1474.     }
  1475.     Coutput << err.insert2
  1476.             << "\" contained in file \""
  1477.             << err.insert3
  1478.             << "\" conflicts with the package \"";
  1479.     if (NotDot(err.insert1))
  1480.     {
  1481.         Coutput << err.insert1
  1482.                 << "/";
  1483.     }
  1484.     Coutput << err.insert2
  1485.             << "\".";
  1486.  
  1487.     return;
  1488. }
  1489.  
  1490.  
  1491. void SemanticError::PrintDIRECTORY_FILE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1492. {
  1493.     Coutput << "The type \""
  1494.             << err.insert1
  1495.             << "\" contained in file \"";
  1496.     if (NotDot(err.insert2))
  1497.     {
  1498.         Coutput << err.insert2
  1499.                 << "/";
  1500.     }
  1501.     Coutput << err.insert3
  1502.             << ".java\" conflicts with the directory \""
  1503.             << err.insert4
  1504.             << "\".";
  1505.  
  1506.     return;
  1507. }
  1508.  
  1509.  
  1510. void SemanticError::PrintFILE_FILE_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1511. {
  1512.     Coutput << "Cannot write class file \""
  1513.             << err.insert1
  1514.             << ".class\" because that name conflicts with the name of the class file \""
  1515.             << err.insert2
  1516.             << "\" in directory \""
  1517.             << err.insert3
  1518.             << "\". This is illegal because file names are case-insensitive in this system.";
  1519.  
  1520.     return;
  1521. }
  1522.  
  1523.  
  1524. void SemanticError::PrintMULTIPLE_PUBLIC_TYPES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1525. {
  1526.     Coutput << "The type \""
  1527.             << err.insert1
  1528.             << "\" is declared public in compilation unit \""
  1529.             << lex_stream -> FileName()
  1530.             << "\" which also contains the public type, \""
  1531.             << err.insert2
  1532.             << "\".";
  1533.  
  1534.     return;
  1535. }
  1536.  
  1537.  
  1538. void SemanticError::PrintMISMATCHED_TYPE_AND_FILE_NAMES(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1539. {
  1540.     Coutput << "The public type \""
  1541.             << err.insert1
  1542.             << "\" does not match the name of its containing file \""
  1543.             << lex_stream -> FileName()
  1544.             << "\".";
  1545.  
  1546.     return;
  1547. }
  1548.  
  1549.  
  1550. void SemanticError::PrintREFERENCE_TO_TYPE_IN_MISMATCHED_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1551. {
  1552.     Coutput << "The type \""
  1553.             << err.insert1
  1554.             << "\" is defined in the file \""
  1555.             << err.insert2
  1556.             << ".java\" but referenced in the file \""
  1557.             << lex_stream -> FileName()
  1558.             << "\". It is recommended that it be redefined in \""
  1559.             << err.insert1
  1560.             << ".java\".";
  1561.  
  1562.     return;
  1563. }
  1564.  
  1565.  
  1566. void SemanticError::PrintDUPLICATE_INNER_TYPE_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1567. {
  1568.     Coutput << "The inner type named \""
  1569.             << err.insert1
  1570.             << "\" is nested in an outer class of the same name at location "
  1571.             << err.insert2
  1572.             << '.';
  1573.  
  1574.     return;
  1575. }
  1576.  
  1577.  
  1578. void SemanticError::PrintDUPLICATE_TYPE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1579. {
  1580.     Coutput << "Duplicate declaration of type \""
  1581.             << err.insert1
  1582.             << "\". The other occurrence is at location "
  1583.             << err.insert2
  1584.             << '.';
  1585.  
  1586.     return;
  1587. }
  1588.  
  1589.  
  1590. void SemanticError::PrintUNNECESSARY_TYPE_IMPORT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1591. {
  1592.     Coutput << "Unnecessary import of type \""
  1593.             << err.insert1
  1594.             << "\". The type is declared at location "
  1595.             << err.insert2
  1596.             << '.';
  1597.  
  1598.     return;
  1599. }
  1600.  
  1601.  
  1602. void SemanticError::PrintUNINITIALIZED_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1603. {
  1604.     Coutput << "The field \""
  1605.             << err.insert1
  1606.             << "\" is not initialized.";
  1607.  
  1608.     return;
  1609. }
  1610.  
  1611.  
  1612. void SemanticError::PrintDUPLICATE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1613. {
  1614.     Coutput << "Duplicate specification of this modifier.";
  1615.  
  1616.     return;
  1617. }
  1618.  
  1619.  
  1620. void SemanticError::PrintDUPLICATE_ACCESS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1621. {
  1622.     Coutput << "Duplicate specification of an access modifier. "
  1623.             "Only one instance of \"public\", \"private\", or \"protected\" may appear in a declaration.";
  1624.  
  1625.     return;
  1626. }
  1627.  
  1628.  
  1629. void SemanticError::PrintINVALID_TOP_LEVEL_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1630. {
  1631.     Coutput << err.insert1
  1632.             << " is not a valid modifier for a top-level class.";
  1633.  
  1634.     return;
  1635. }
  1636.  
  1637.  
  1638. void SemanticError::PrintINVALID_INNER_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1639. {
  1640.     Coutput << err.insert1
  1641.             << " is not a valid modifier for an inner class.";
  1642.  
  1643.     return;
  1644. }
  1645.  
  1646.  
  1647. void SemanticError::PrintINVALID_STATIC_INNER_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1648. {
  1649.     Coutput << err.insert1
  1650.             << " is not a valid modifier for an inner class that is enclosed in an interface.";
  1651.  
  1652.     return;
  1653. }
  1654.  
  1655.  
  1656. void SemanticError::PrintINVALID_LOCAL_CLASS_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1657. {
  1658.     Coutput << err.insert1
  1659.             << " is not a valid modifier for a local inner class.";
  1660.  
  1661.     return;
  1662. }
  1663.  
  1664.  
  1665. void SemanticError::PrintFINAL_ABSTRACT_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1666. {
  1667.     Coutput << "A class may not be declared both \"final\" and \"abstract\".";
  1668.  
  1669.     return;
  1670. }
  1671.  
  1672.  
  1673. void SemanticError::PrintINVALID_INTERFACE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1674. {
  1675.     Coutput << err.insert1
  1676.             << " is not a valid interface modifier.";
  1677.  
  1678.     return;
  1679. }
  1680.  
  1681.  
  1682. void SemanticError::PrintVOLATILE_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1683. {
  1684.     Coutput << "A \"volatile\" field may not be declared \"final\".";
  1685.  
  1686.     return;
  1687. }
  1688.  
  1689.  
  1690. void SemanticError::PrintFINAL_VOLATILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1691. {
  1692.     Coutput << "A \"final\" field may not be declared \"volatile\".";
  1693.  
  1694.     return;
  1695. }
  1696.  
  1697.  
  1698. void SemanticError::PrintINVALID_FIELD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1699. {
  1700.     Coutput << err.insert1
  1701.             << " is not a valid field modifier.";
  1702.  
  1703.     return;
  1704. }
  1705.  
  1706.  
  1707. void SemanticError::PrintINVALID_LOCAL_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1708. {
  1709.     Coutput << err.insert1
  1710.             << " is not a valid local variable or parameter modifier.";
  1711.  
  1712.     return;
  1713. }
  1714.  
  1715.  
  1716. void SemanticError::PrintINVALID_METHOD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1717. {
  1718.     Coutput << err.insert1
  1719.             << " is not a valid method modifier.";
  1720.  
  1721.     return;
  1722. }
  1723.  
  1724.  
  1725. void SemanticError::PrintINVALID_SIGNATURE_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1726. {
  1727.     Coutput << err.insert1
  1728.             << " is not a valid signature modifier.";
  1729.  
  1730.     return;
  1731. }
  1732.  
  1733.  
  1734. void SemanticError::PrintINVALID_CONSTRUCTOR_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1735. {
  1736.     Coutput << err.insert1
  1737.             << " is not a valid constructor modifier.";
  1738.  
  1739.     return;
  1740. }
  1741.  
  1742.  
  1743. void SemanticError::PrintINVALID_CONSTANT_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1744. {
  1745.     Coutput << err.insert1
  1746.             << " is not a valid constant modifier.";
  1747.  
  1748.     return;
  1749. }
  1750.  
  1751.  
  1752. void SemanticError::PrintPARENT_TYPE_IN_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1753. {
  1754.     Coutput << "The type associated with this construct is (or depends on) the type ";
  1755.     if (NotDot(err.insert1))
  1756.     {
  1757.         Coutput << err.insert1
  1758.                 << "/";
  1759.     }
  1760.     Coutput << err.insert2
  1761.             << " which is contained in an unnamed package.";
  1762.  
  1763.     return;
  1764. }
  1765.  
  1766.  
  1767. void SemanticError::PrintRECOMPILATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1768. {
  1769.     Coutput << "The type associated with this construct depends on file ";
  1770.     if (NotDot(err.insert1))
  1771.     {
  1772.         Coutput << err.insert1
  1773.                 << "/";
  1774.     }
  1775.     Coutput << err.insert2
  1776.             << ".class which, in turn, depends on file ";
  1777.     if (NotDot(err.insert3))
  1778.     {
  1779.         Coutput << err.insert3
  1780.                 << "/";
  1781.     }
  1782.     Coutput << err.insert4
  1783.             << ".java. All files that depend on this source file, in particular, ";
  1784.     if (NotDot(err.insert1))
  1785.     {
  1786.         Coutput << err.insert1
  1787.                 << "/";
  1788.     }
  1789.     Coutput << err.insert2
  1790.             << ".java should be recompiled.";
  1791.  
  1792.     return;
  1793. }
  1794.  
  1795.  
  1796. void SemanticError::PrintTYPE_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1797. {
  1798.     Coutput << "Type ";
  1799.     if (NotDot(err.insert1))
  1800.     {
  1801.         Coutput << err.insert1
  1802.                 << "/";
  1803.     }
  1804.     Coutput << err.insert2
  1805.             << " was not found.";
  1806.  
  1807.     return;
  1808. }
  1809.  
  1810.  
  1811. void SemanticError::PrintDUPLICATE_ON_DEMAND_IMPORT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1812. {
  1813.     Coutput << "Type "
  1814.             << err.insert1
  1815.             << " is imported on demand from package "
  1816.             << err.insert2
  1817.             << " and package "
  1818.             << err.insert3
  1819.             << '.';
  1820.  
  1821.     return;
  1822. }
  1823.  
  1824.  
  1825. void SemanticError::PrintNOT_A_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1826. {
  1827.     Coutput << "A type is expected here.";
  1828.  
  1829.     return;
  1830. }
  1831.  
  1832.  
  1833. void SemanticError::PrintNOT_A_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1834. {
  1835.     Coutput << "Interface \"";
  1836.     if (NotDot(err.insert1))
  1837.     {
  1838.         Coutput << err.insert1
  1839.                 << '/';
  1840.     }
  1841.     Coutput << err.insert2
  1842.             << "\" cannot be used where a class is expected.";
  1843.  
  1844.     return;
  1845. }
  1846.  
  1847.  
  1848. void SemanticError::PrintNOT_AN_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1849. {
  1850.     Coutput << "Class ";
  1851.     if (NotDot(err.insert1))
  1852.     {
  1853.         Coutput << err.insert1
  1854.                 << '/';
  1855.     }
  1856.     Coutput << err.insert2
  1857.             << " cannot be used where an interface is expected.";
  1858.  
  1859.     return;
  1860. }
  1861.  
  1862.  
  1863. void SemanticError::PrintSUPER_IS_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1864. {
  1865.     Coutput << "The super class \"";
  1866.     if (NotDot(err.insert1))
  1867.     {
  1868.         Coutput << err.insert1
  1869.                 << '/';
  1870.     }
  1871.     Coutput << err.insert2
  1872.             << "\" is final. A final class must not have subclasses.";
  1873.  
  1874.     return;
  1875. }
  1876.  
  1877.  
  1878. void SemanticError::PrintOBJECT_WITH_SUPER_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1879. {
  1880.     Coutput << "The type "
  1881.             << err.insert1
  1882.             << '/'
  1883.             << err.insert2
  1884.             << " must not have a super type.";
  1885.  
  1886.     return;
  1887. }
  1888.  
  1889.  
  1890. void SemanticError::PrintOBJECT_HAS_NO_SUPER_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1891. {
  1892.     Coutput << "The type "
  1893.             << err.insert1
  1894.             << '/'
  1895.             << err.insert2
  1896.             << " does not have a super type.";
  1897.  
  1898.     return;
  1899. }
  1900.  
  1901.  
  1902. void SemanticError::PrintDUPLICATE_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1903. {
  1904.     Coutput << "Duplicate declaration of field \""
  1905.             << err.insert1
  1906.             << "\" in type \""
  1907.             << err.insert2
  1908.             << "\".";
  1909.  
  1910.     return;
  1911. }
  1912.  
  1913.  
  1914. void SemanticError::PrintDUPLICATE_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1915. {
  1916.     Coutput << "Duplicate declaration of method \""
  1917.             << err.insert1
  1918.             << "\" in type \""
  1919.             << err.insert2
  1920.             << "\".";
  1921.  
  1922.     return;
  1923. }
  1924.  
  1925.  
  1926. void SemanticError::PrintMISMATCHED_INHERITED_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1927. {
  1928.     Coutput << "The return type of method \""
  1929.             << err.insert1
  1930.             << "\" does not match the return type of method \""
  1931.             << err.insert2
  1932.             << "\" inherited from type \"";
  1933.     if (NotDot(err.insert3))
  1934.     {
  1935.         Coutput << err.insert3
  1936.                 << "/";
  1937.     }
  1938.     Coutput << err.insert4
  1939.             << "\".";
  1940.  
  1941.     return;
  1942. }
  1943.  
  1944.  
  1945. void SemanticError::PrintMISMATCHED_INHERITED_METHOD_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1946. {
  1947.     Coutput << "In class \""
  1948.             << err.insert1
  1949.             << "\", the method \""
  1950.             << err.insert2
  1951.             << "\", inherited from type \"";
  1952.     if (NotDot(err.insert3))
  1953.     {
  1954.         Coutput << err.insert3
  1955.                 << "/";
  1956.     }
  1957.     Coutput << err.insert4
  1958.             << "\", does not have the same return type as the overridden method \""
  1959.             << err.insert5
  1960.             << "\", inherited from type \"";
  1961.     if (NotDot(err.insert6))
  1962.     {
  1963.         Coutput << err.insert6
  1964.                 << "/";
  1965.     }
  1966.     Coutput << err.insert7
  1967.             << "\".";
  1968.  
  1969.     return;
  1970. }
  1971.  
  1972.  
  1973. void SemanticError::PrintDUPLICATE_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1974. {
  1975.     Coutput << "Duplicate declaration of this constructor in type \""
  1976.             << err.insert1
  1977.             << "\".";
  1978.  
  1979.     return;
  1980. }
  1981.  
  1982.  
  1983. void SemanticError::PrintMISMATCHED_CONSTRUCTOR_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1984. {
  1985.     Coutput << "The name of the constructor \""
  1986.             << err.insert1
  1987.             << "\" does not match the name of the class \""
  1988.             << err.insert2
  1989.             << "\".";
  1990.  
  1991.     return;
  1992. }
  1993.  
  1994.  
  1995. void SemanticError::PrintMETHOD_WITH_CONSTRUCTOR_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  1996. {
  1997.     Coutput << "The name of this method \""
  1998.             << err.insert1
  1999.             << "\" matches the name of the containing class. "
  2000.                "However, the method is not a constructor since its declarator is qualified with a type.";
  2001.  
  2002.     return;
  2003. }
  2004.  
  2005.  
  2006. void SemanticError::PrintDUPLICATE_FORMAL_PARAMETER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2007. {
  2008.     Coutput << "Duplicate declaration of formal parameter "
  2009.             << err.insert1
  2010.             << '.';
  2011.  
  2012.     return;
  2013. }
  2014.  
  2015.  
  2016. void SemanticError::PrintDUPLICATE_LOCAL_VARIABLE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2017. {
  2018.     Coutput << "Duplicate declaration of local variable \""
  2019.             << err.insert1
  2020.             << "\".";
  2021.  
  2022.     return;
  2023. }
  2024.  
  2025.  
  2026. void SemanticError::PrintDUPLICATE_LOCAL_TYPE_DECLARATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2027. {
  2028.     Coutput << "Duplicate declaration of local class \""
  2029.             << err.insert1
  2030.             << "\". The other occurrence is at location "
  2031.             << err.insert2
  2032.             << '.';
  2033.  
  2034.     return;
  2035. }
  2036.  
  2037.  
  2038. void SemanticError::PrintMULTIPLE_DEFAULT_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2039. {
  2040.     Coutput << "Multiple specification of default label in switch statement.";
  2041.  
  2042.     return;
  2043. }
  2044.  
  2045.  
  2046. void SemanticError::PrintUNDECLARED_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2047. {
  2048.     Coutput << err.insert1
  2049.             << " is an undeclared label.";
  2050.  
  2051.     return;
  2052. }
  2053.  
  2054.  
  2055. void SemanticError::PrintDUPLICATE_LABEL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2056. {
  2057.     Coutput << "Duplicate declaration of label \""
  2058.             << err.insert1
  2059.             << "\".";
  2060.  
  2061.     return;
  2062. }
  2063.  
  2064.  
  2065. void SemanticError::PrintTYPE_NOT_THROWABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2066. {
  2067.     Coutput << "The type \"";
  2068.     if (NotDot(err.insert1))
  2069.     {
  2070.         Coutput << err.insert1
  2071.                 << "/";
  2072.     }
  2073.     Coutput << err.insert2
  2074.             << "\" is not a subclass of \"Throwable\".";
  2075.  
  2076.     return;
  2077. }
  2078.  
  2079.  
  2080. void SemanticError::PrintCATCH_PRIMITIVE_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2081. {
  2082.     Coutput << "A primitive type cannot be used to declare a catch clause parameter - the type Error is assumed.";
  2083.  
  2084.     return;
  2085. }
  2086.  
  2087.  
  2088. void SemanticError::PrintCATCH_ARRAY_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2089. {
  2090.     Coutput << "A array type cannot be used to declare a catch clause parameter - the type Error is assumed.";
  2091.  
  2092.     return;
  2093. }
  2094.  
  2095.  
  2096. void SemanticError::PrintAMBIGUOUS_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2097. {
  2098.     Coutput << "The field name \""
  2099.             << err.insert1
  2100.             << "\" is an ambiguous name found in the types \"";
  2101.     if (NotDot(err.insert2))
  2102.     {
  2103.         Coutput << err.insert2
  2104.                 << "/";
  2105.     }
  2106.     Coutput << err.insert3
  2107.             << "\" and \"";
  2108.     if (NotDot(err.insert4))
  2109.     {
  2110.         Coutput << err.insert4
  2111.                 << "/";
  2112.     }
  2113.     Coutput << err.insert5
  2114.             << "\".";
  2115.  
  2116.     return;
  2117. }
  2118.  
  2119.  
  2120. void SemanticError::PrintAMBIGUOUS_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2121. {
  2122.     Coutput << "The the nested type name \""
  2123.             << err.insert1
  2124.             << "\" is an ambiguous name found in the types \"";
  2125.     if (NotDot(err.insert2))
  2126.     {
  2127.         Coutput << err.insert2
  2128.                 << "/";
  2129.     }
  2130.     Coutput << err.insert3
  2131.             << "\" and \"";
  2132.     if (NotDot(err.insert4))
  2133.     {
  2134.         Coutput << err.insert4
  2135.                 << "/";
  2136.     }
  2137.     Coutput << err.insert5
  2138.             << "\".";
  2139.  
  2140.     return;
  2141. }
  2142.  
  2143.  
  2144. void SemanticError::PrintFIELD_IS_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2145. {
  2146.     Coutput << "The name \""
  2147.             << err.insert1
  2148.             << "\" cannot be dereferenced as it represents a type.";
  2149.  
  2150.     return;
  2151. }
  2152.  
  2153.  
  2154. void SemanticError::PrintFIELD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2155. {
  2156.     Coutput << "No field named \""
  2157.             << err.insert1
  2158.             << "\" was found in type \"";
  2159.     if (NotDot(err.insert2))
  2160.     {
  2161.         Coutput << err.insert2
  2162.                 << "/";
  2163.     }
  2164.     Coutput << err.insert3
  2165.             << "\".";
  2166.  
  2167.     return;
  2168. }
  2169.  
  2170.  
  2171. void SemanticError::PrintFIELD_NAME_MISSPELLED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2172. {
  2173.     Coutput << "No field named \""
  2174.             << err.insert1
  2175.             << "\" was found in type \"";
  2176.     if (NotDot(err.insert2))
  2177.     {
  2178.         Coutput << err.insert2
  2179.                 << "/";
  2180.     }
  2181.     Coutput << err.insert3
  2182.             << "\". However, there is an accessible field \""
  2183.             << err.insert4
  2184.             << "\" whose name closely matches the name \""
  2185.             << err.insert1
  2186.             << "\".";
  2187.  
  2188.     return;
  2189. }
  2190.  
  2191.  
  2192. void SemanticError::PrintFIELD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2193. {
  2194.     Coutput << "The field \""
  2195.             << err.insert1
  2196.             << "\" contained in class \"";
  2197.     if (NotDot(err.insert2))
  2198.     {
  2199.         Coutput << err.insert2
  2200.                 << "/";
  2201.     }
  2202.     Coutput << err.insert3
  2203.             << "\" has private access. Therefore, it is not accessible in class \"";
  2204.     if (NotDot(err.insert4))
  2205.     {
  2206.         Coutput << err.insert4
  2207.                 << "/";
  2208.     }
  2209.     Coutput << err.insert5
  2210.             << "\".";
  2211.  
  2212.     return;
  2213. }
  2214.  
  2215.  
  2216. void SemanticError::PrintFIELD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2217. {
  2218.     Coutput << "The field \""
  2219.             << err.insert1
  2220.             << "\" contained in class \"";
  2221.     if (NotDot(err.insert2))
  2222.     {
  2223.         Coutput << err.insert2
  2224.                 << "/";
  2225.     }
  2226.     Coutput << err.insert3
  2227.             << "\" has default access. Therefore, it is not accessible in class \"";
  2228.     if (NotDot(err.insert4))
  2229.     {
  2230.         Coutput << err.insert4
  2231.                 << "/";
  2232.     }
  2233.     Coutput << err.insert5
  2234.             << "\" which is in a different package.";
  2235.  
  2236.     return;
  2237. }
  2238.  
  2239.  
  2240. void SemanticError::PrintNAME_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2241. {
  2242.     Coutput << "No entity named \""
  2243.             << err.insert1
  2244.             << "\" was found in this environment.";
  2245.  
  2246.     return;
  2247. }
  2248.  
  2249.  
  2250. void SemanticError::PrintNAME_NOT_YET_AVAILABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2251. {
  2252.     Coutput << "Illegal use of name \""
  2253.             << err.insert1
  2254.             << "\" which has not yet been fully declared at this point.";
  2255.  
  2256.     return;
  2257. }
  2258.  
  2259.  
  2260. void SemanticError::PrintNAME_NOT_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2261. {
  2262.     Coutput << "The name \""
  2263.             << err.insert1
  2264.             << "\" does not denote a valid variable. If \""
  2265.             << err.insert1
  2266.             << "\" is a method that takes no argument, it must be followed by \"()\".";
  2267.  
  2268.     return;
  2269. }
  2270.  
  2271.  
  2272. void SemanticError::PrintMETHOD_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2273. {
  2274.     Coutput << "No match was found for method \""
  2275.             << err.insert1
  2276.             << "\".";
  2277.  
  2278.     return;
  2279. }
  2280.  
  2281.  
  2282. void SemanticError::PrintMETHOD_NAME_NOT_FOUND_IN_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2283. {
  2284.     Coutput << "No method named \""
  2285.             << err.insert1
  2286.             << "\" was found in type \"";
  2287.     if (NotDot(err.insert2))
  2288.     {
  2289.         Coutput << err.insert2
  2290.                 << "/";
  2291.     }
  2292.     Coutput << err.insert3
  2293.             << "\".";
  2294.  
  2295.     return;
  2296. }
  2297.  
  2298.  
  2299. void SemanticError::PrintMETHOD_NAME_MISSPELLED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2300. {
  2301.     Coutput << "No method named \""
  2302.             << err.insert1
  2303.             << "\" was found in type \"";
  2304.     if (NotDot(err.insert2))
  2305.     {
  2306.         Coutput << err.insert2
  2307.                 << "/";
  2308.     }
  2309.     Coutput << err.insert3
  2310.             << "\". However, there is an accessible method \""
  2311.             << err.insert4
  2312.             << "\" whose name closely matches the name \""
  2313.             << err.insert1
  2314.             << "\".";
  2315.  
  2316.     return;
  2317. }
  2318.  
  2319.  
  2320. void SemanticError::PrintMETHOD_WITH_PRIVATE_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2321. {
  2322.     Coutput << "Method \""
  2323.             << err.insert1
  2324.             << "\" in class \"";
  2325.     if (NotDot(err.insert2))
  2326.     {
  2327.         Coutput << err.insert2
  2328.                 << "/";
  2329.     }
  2330.     Coutput << err.insert3
  2331.             << "\" has private access. Therefore, it is not accessible in class \"";
  2332.     if (NotDot(err.insert4))
  2333.     {
  2334.         Coutput << err.insert4
  2335.                 << "/";
  2336.     }
  2337.     Coutput << err.insert5
  2338.             << "\".";
  2339.  
  2340.     return;
  2341. }
  2342.  
  2343.  
  2344. void SemanticError::PrintMETHOD_WITH_DEFAULT_ACCESS_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2345. {
  2346.     Coutput << "Method \""
  2347.             << err.insert1
  2348.             << "\" in class \"";
  2349.     if (NotDot(err.insert2))
  2350.     {
  2351.         Coutput << err.insert2
  2352.                 << "/";
  2353.     }
  2354.     Coutput << err.insert3
  2355.             << "\" has protected or default access. Therefore, it is not accessible in class \"";
  2356.     if (NotDot(err.insert4))
  2357.     {
  2358.         Coutput << err.insert4
  2359.                 << "/";
  2360.     }
  2361.     Coutput << err.insert5
  2362.             << "\" which is in a different package.";
  2363.  
  2364.     return;
  2365. }
  2366.  
  2367.  
  2368. void SemanticError::PrintHIDDEN_METHOD_IN_ENCLOSING_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2369. {
  2370.     Coutput << "The method \""
  2371.             << err.insert1
  2372.             << "\" contained in the enclosing type \"";
  2373.     if (NotDot(err.insert2))
  2374.     {
  2375.         Coutput << err.insert2
  2376.                 << "/";
  2377.     }
  2378.     Coutput << err.insert3
  2379.             << "\" is a perfect match for this method call."
  2380.                " However, it is not visible in this nested class because a"
  2381.                " method with the same name in an intervening class is hiding it.";
  2382.  
  2383.     return;
  2384. }
  2385.  
  2386.  
  2387. void SemanticError::PrintFIELD_NOT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2388. {
  2389.     Coutput << "The name \""
  2390.             << err.insert1
  2391.             << "\" is not a method name but the name of a field member of the type \"";
  2392.     if (NotDot(err.insert2))
  2393.     {
  2394.         Coutput << err.insert2
  2395.                 << "/";
  2396.     }
  2397.     Coutput << err.insert3
  2398.             << "\".";
  2399.  
  2400.     return;
  2401. }
  2402.  
  2403.  
  2404. void SemanticError::PrintTYPE_NOT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2405. {
  2406.     Coutput << "The keyword \"new\" is expected before this name, \""
  2407.             << err.insert1
  2408.             << "\", as it is not the name of a method but the name of a type.";
  2409.  
  2410.     return;
  2411. }
  2412.  
  2413.  
  2414. void SemanticError::PrintTYPE_NOT_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2415. {
  2416.     Coutput << "A type \""
  2417.             << err.insert1
  2418.             << "\" was found where a field name or method call was expected. Did you mean to write \""
  2419.             << err.insert1
  2420.             << ".xxx\", or \"new "
  2421.             << err.insert1
  2422.             << "()\", or ... ?";
  2423.  
  2424.     return;
  2425. }
  2426.  
  2427.  
  2428. void SemanticError::PrintMETHOD_NOT_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2429. {
  2430.     Coutput << "The name \""
  2431.             << err.insert1
  2432.             << "\" is not a field name but the name of a method declared in the type \"";
  2433.     if (NotDot(err.insert2))
  2434.     {
  2435.         Coutput << err.insert2
  2436.                 << "/";
  2437.     }
  2438.     Coutput << err.insert3
  2439.             << "\".";
  2440.  
  2441.     return;
  2442. }
  2443.  
  2444.  
  2445. void SemanticError::PrintAMBIGUOUS_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2446. {
  2447.     Coutput << "Ambiguous invocation of constructor \""
  2448.             << err.insert1
  2449.             << "\".";
  2450.  
  2451.     return;
  2452. }
  2453.  
  2454.  
  2455. void SemanticError::PrintAMBIGUOUS_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2456. {
  2457.     Coutput << "Ambiguous invocation of method \""
  2458.             << err.insert1
  2459.             << "\". At least two methods are accessible from here: Method \""
  2460.             << err.insert2
  2461.             << "\" declared in type \"";
  2462.     if (NotDot(err.insert3))
  2463.     {
  2464.         Coutput << err.insert3
  2465.                 << '/';
  2466.     }
  2467.     Coutput << err.insert4
  2468.             << "\" and method \""
  2469.             << err.insert5
  2470.             << "\" declared in type \"";
  2471.     if (NotDot(err.insert6))
  2472.     {
  2473.         Coutput << err.insert6
  2474.                 << '/';
  2475.     }
  2476.     Coutput << err.insert7
  2477.             << "\".";
  2478.  
  2479.     return;
  2480. }
  2481.  
  2482.  
  2483. void SemanticError::PrintNAME_NOT_CLASS_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2484. {
  2485.     Coutput << "The name \""
  2486.             << err.insert1
  2487.             << "\" does not denote a class (static) variable.";
  2488.  
  2489.     return;
  2490. }
  2491.  
  2492.  
  2493. void SemanticError::PrintNOT_A_NUMERIC_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2494. {
  2495.     Coutput << "Only a variable of numeric type can appear in this context.";
  2496.  
  2497.     return;
  2498. }
  2499.  
  2500.  
  2501. void SemanticError::PrintMETHOD_NOT_CLASS_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2502. {
  2503.     Coutput << "The method \""
  2504.             << err.insert1
  2505.             << "\" does not denote a class method.";
  2506.  
  2507.     return;
  2508. }
  2509.  
  2510.  
  2511. void SemanticError::PrintABSTRACT_TYPE_CREATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2512. {
  2513.     Coutput << "Attempt to instantiate an abstract class \""
  2514.             << err.insert1
  2515.             << "\".";
  2516.  
  2517.     return;
  2518. }
  2519.  
  2520.  
  2521. void SemanticError::PrintCONSTRUCTOR_NOT_FOUND(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2522. {
  2523.     Coutput << "No match was found for constructor \""
  2524.             << err.insert1
  2525.             << "\".";
  2526.  
  2527.     return;
  2528. }
  2529.  
  2530.  
  2531. void SemanticError::PrintMETHOD_FOUND_FOR_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2532. {
  2533.     Coutput << "No match was found for constructor \""
  2534.             << err.insert1
  2535.             << "\". However, a method with the same name was found at location "
  2536.             << err.insert2
  2537.             << '.';
  2538.  
  2539.     return;
  2540. }
  2541.  
  2542.  
  2543. void SemanticError::PrintINCOMPATIBLE_TYPE_FOR_INITIALIZATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2544. {
  2545.     Coutput << "The type of the left-hand side (or array type) in this initialization (or array creation expression), \"";
  2546.     if (NotDot(err.insert1))
  2547.     {
  2548.         Coutput << err.insert1
  2549.                 << '/';
  2550.     }
  2551.     Coutput << err.insert2
  2552.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2553.     if (NotDot(err.insert3))
  2554.     {
  2555.         Coutput << err.insert3
  2556.                 << '/';
  2557.     }
  2558.     Coutput << err.insert4
  2559.             << "\".";
  2560.  
  2561.     return;
  2562. }
  2563.  
  2564.  
  2565. void SemanticError::PrintINCOMPATIBLE_TYPE_FOR_ASSIGNMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2566. {
  2567.     Coutput << "The type of the left-hand side in this assignment, \"";
  2568.     if (NotDot(err.insert1))
  2569.     {
  2570.         Coutput << err.insert1
  2571.                 << '/';
  2572.     }
  2573.     Coutput << err.insert2
  2574.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2575.     if (NotDot(err.insert3))
  2576.     {
  2577.         Coutput << err.insert3
  2578.                 << '/';
  2579.     }
  2580.     Coutput << err.insert4
  2581.             << "\".";
  2582.  
  2583.     return;
  2584. }
  2585.  
  2586.  
  2587. void SemanticError::PrintINCOMPATIBLE_TYPE_FOR_CONDITIONAL_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2588. {
  2589.     Coutput << "In this conditional expression, the type of the false subexpression, \"";
  2590.     if (NotDot(err.insert1))
  2591.     {
  2592.         Coutput << err.insert1
  2593.                 << '/';
  2594.     }
  2595.     Coutput << err.insert2
  2596.             << "\", is not compatible with the type of the true subexpression, \"";
  2597.     if (NotDot(err.insert3))
  2598.     {
  2599.         Coutput << err.insert3
  2600.                 << '/';
  2601.     }
  2602.     Coutput << err.insert4
  2603.             << "\".";
  2604.  
  2605.     return;
  2606. }
  2607.  
  2608.  
  2609. void SemanticError::PrintVOID_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2610. {
  2611.     Coutput << "Arrays of type \"void\" are not legal.";
  2612.  
  2613.     return;
  2614. }
  2615.  
  2616.  
  2617. void SemanticError::PrintVOID_TYPE_IN_EQUALITY_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2618. {
  2619.     Coutput << "Subexpressions of type \"void\" may not appear in an EqualityExpression.";
  2620.  
  2621.     return;
  2622. }
  2623.  
  2624.  
  2625. void SemanticError::PrintINCOMPATIBLE_TYPE_FOR_BINARY_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2626. {
  2627.     Coutput << "The type of the left-hand side expression, \"";
  2628.     if (NotDot(err.insert1))
  2629.     {
  2630.         Coutput << err.insert1
  2631.                 << '/';
  2632.     }
  2633.     Coutput << err.insert2
  2634.             << "\", is not compatible with the type of the right-hand side expression, \"";
  2635.     if (NotDot(err.insert3))
  2636.     {
  2637.         Coutput << err.insert3
  2638.                 << '/';
  2639.     }
  2640.     Coutput << err.insert4
  2641.             << "\" (and vice-versa).";
  2642.  
  2643.     return;
  2644. }
  2645.  
  2646.  
  2647. void SemanticError::PrintINVALID_INSTANCEOF_CONVERSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2648. {
  2649.     Coutput << "The type of the left-side expression, \"";
  2650.     if (NotDot(err.insert1))
  2651.     {
  2652.         Coutput << err.insert1
  2653.                 << '/';
  2654.     }
  2655.     Coutput << err.insert2
  2656.             << "\", cannot possibly be an instance of type \"";
  2657.     if (NotDot(err.insert3))
  2658.     {
  2659.         Coutput << err.insert3
  2660.                 << '/';
  2661.     }
  2662.     Coutput << err.insert4
  2663.             << "\".";
  2664.  
  2665.     return;
  2666. }
  2667.  
  2668.  
  2669. void SemanticError::PrintINVALID_CAST_CONVERSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2670. {
  2671.     Coutput << "An expression of type \""
  2672.             << err.insert1
  2673.             << "\" cannot be cast into type \""
  2674.             << err.insert2
  2675.             << "\".";
  2676.  
  2677.     return;
  2678. }
  2679.  
  2680.  
  2681. void SemanticError::PrintINVALID_CAST_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2682. {
  2683.     Coutput << "Expression found where a type is expected.";
  2684.  
  2685.     return;
  2686. }
  2687.  
  2688.  
  2689. void SemanticError::PrintTYPE_NOT_PRIMITIVE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2690. {
  2691.     Coutput << "The type of this expression, \""
  2692.             << err.insert1
  2693.             << "\", is not a primitive type.";
  2694.  
  2695.     return;
  2696. }
  2697.  
  2698.  
  2699. void SemanticError::PrintTYPE_NOT_INTEGRAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2700. {
  2701.     Coutput << "The type of this expression, \""
  2702.             << err.insert1
  2703.             << "\", is not an integral type.";
  2704.  
  2705.     return;
  2706. }
  2707.  
  2708.  
  2709. void SemanticError::PrintTYPE_NOT_NUMERIC(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2710. {
  2711.     Coutput << "The type of this expression, \""
  2712.             << err.insert1
  2713.             << "\", is not numeric.";
  2714.  
  2715.     return;
  2716. }
  2717.  
  2718.  
  2719. void SemanticError::PrintTYPE_NOT_INTEGER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2720. {
  2721.     Coutput << "The type of this expression, \""
  2722.             << err.insert1
  2723.             << "\", cannot be promoted to \"int\" by widening conversion.";
  2724.  
  2725.     return;
  2726. }
  2727.  
  2728.  
  2729. void SemanticError::PrintTYPE_NOT_BOOLEAN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2730. {
  2731.     Coutput << "The type of this expression, \""
  2732.             << err.insert1
  2733.             << "\", is not boolean.";
  2734.  
  2735.     return;
  2736. }
  2737.  
  2738.  
  2739. void SemanticError::PrintTYPE_NOT_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2740. {
  2741.     Coutput << "The type of this expression, \""
  2742.             << err.insert1
  2743.             << "\", is not an array type.";
  2744.  
  2745.     return;
  2746. }
  2747.  
  2748.  
  2749. void SemanticError::PrintTYPE_NOT_REFERENCE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2750. {
  2751.     Coutput << "The type of this expression, \""
  2752.             << err.insert1
  2753.             << "\", is not a valid reference type in this context.";
  2754.  
  2755.     return;
  2756. }
  2757.  
  2758.  
  2759. void SemanticError::PrintTYPE_NOT_VALID_FOR_SWITCH(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2760. {
  2761.     Coutput << "The type of a switch statement expression must be either \"int\", \"short\", \"char\" or \"byte\"."
  2762.             << " The type of this expression is \"";
  2763.     if (NotDot(err.insert1))
  2764.     {
  2765.         Coutput << err.insert1
  2766.                 << '/';
  2767.     }
  2768.     Coutput << err.insert2
  2769.             << "\".";
  2770.  
  2771.     return;
  2772. }
  2773.  
  2774.  
  2775. void SemanticError::PrintTYPE_IS_VOID(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2776. {
  2777.     Coutput << "An expression of type \""
  2778.             << err.insert1
  2779.             << "\" is not valid in this context.";
  2780.  
  2781.     return;
  2782. }
  2783.  
  2784.  
  2785. void SemanticError::PrintVALUE_NOT_REPRESENTABLE_IN_SWITCH_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2786. {
  2787.     Coutput << "The value of this expression, "
  2788.             << err.insert1
  2789.             << ", cannot be represented in the type of the switch statement expression, \""
  2790.             << err.insert2
  2791.             << "\".";
  2792.  
  2793.     return;
  2794. }
  2795.  
  2796.  
  2797. void SemanticError::PrintTYPE_NOT_CONVERTIBLE_TO_SWITCH_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2798. {
  2799.     Coutput << "The type of this expression, \""
  2800.             << err.insert1
  2801.             << "\", is not assignment-convertible to the type of the switch statement expression, \""
  2802.             << err.insert2
  2803.             << "\".";
  2804.  
  2805.     return;
  2806. }
  2807.  
  2808.  
  2809. void SemanticError::PrintDUPLICATE_CASE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2810. {
  2811.     Coutput << "The value of this expression, "
  2812.             << err.insert1
  2813.             << ", has already been used in this switch statement.";
  2814.  
  2815.     return;
  2816. }
  2817.  
  2818.  
  2819. void SemanticError::PrintMISPLACED_THIS_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2820. {
  2821.     Coutput << "A \"this\" expression may only be used in the body of an instance method, "
  2822.                "constructor (after the explicit constructor invocation, if any), "
  2823.                "initializer block, or in the initializer expression of an instance variable.";
  2824.  
  2825.     return;
  2826. }
  2827.  
  2828.  
  2829. void SemanticError::PrintMISPLACED_SUPER_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2830. {
  2831.     Coutput << "A \"super\" expression may only appear in the body of a class that has a super class and"
  2832.                " it must be enclosed in the body of an instance method or constructor or in the initializer"
  2833.                " of an instance variable.";
  2834.  
  2835.     return;
  2836. }
  2837.  
  2838.  
  2839. void SemanticError::PrintFINAL_VARIABLE_TARGET_IN_LOOP(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2840. {
  2841.     Coutput << "Possible attempt to assign a value to a final variable \""
  2842.             << err.insert1
  2843.             << "\""
  2844.             << ", within the body of a loop that may execute more than once.";
  2845.  
  2846.     return;
  2847. }
  2848.  
  2849.  
  2850. void SemanticError::PrintTARGET_VARIABLE_IS_FINAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2851. {
  2852.     Coutput << "Possible attempt to reassign a value to the final variable \""
  2853.             << err.insert1
  2854.             << "\"";
  2855.     if (err.insert2)
  2856.     {
  2857.         Coutput << ". The other assignement was at location "
  2858.                 << err.insert2;
  2859.     }
  2860.     Coutput << '.';
  2861.  
  2862.     return;
  2863. }
  2864.  
  2865.  
  2866. void SemanticError::PrintUNINITIALIZED_FINAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2867. {
  2868.     Coutput << "A final variable must be initialized.";
  2869.  
  2870.     return;
  2871. }
  2872.  
  2873.  
  2874. void SemanticError::PrintUNINITIALIZED_STATIC_FINAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2875. {
  2876.     Coutput << "A blank class final variable must be initialized in a static initializer block. "
  2877.                "We will assume that it has been initialized to avoid emitting spurious messages.";
  2878.  
  2879.     return;
  2880. }
  2881.  
  2882.  
  2883. void SemanticError::PrintUNINITIALIZED_FINAL_VARIABLE_IN_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2884. {
  2885.     Coutput << "The blank final field \"this."
  2886.             << err.insert1
  2887.             << "\" is not definitely assigned a value in this constructor.";
  2888.  
  2889.     return;
  2890. }
  2891.  
  2892.  
  2893. void SemanticError::PrintINIT_SCALAR_WITH_ARRAY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2894. {
  2895.     Coutput << "An array initializer cannot be used to initialize a variable of type \""
  2896.             << err.insert1
  2897.             << "\".";
  2898.  
  2899.     return;
  2900. }
  2901.  
  2902.  
  2903. void SemanticError::PrintINIT_ARRAY_WITH_SCALAR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2904. {
  2905.     Coutput << "A single expression cannot be used to initialize an array variable of type \""
  2906.             << err.insert1
  2907.             << "\".";
  2908.  
  2909.     return;
  2910. }
  2911.  
  2912.  
  2913. void SemanticError::PrintINVALID_BYTE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2914. {
  2915.     Coutput << "A byte value must be an integer value (note that a character literal is not an integer value) in the range -128..127.";
  2916.  
  2917.     return;
  2918. }
  2919.  
  2920.  
  2921. void SemanticError::PrintINVALID_SHORT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2922. {
  2923.     Coutput << "A short value must be an integer value (note that a character literal is not an integer value) "
  2924.                "in the range -32768..32767.";
  2925.  
  2926.     return;
  2927. }
  2928.  
  2929.  
  2930. void SemanticError::PrintINVALID_CHARACTER_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2931. {
  2932.     Coutput << "A character literal must be a valid unicode value - i.e., a character literal enclosed in single quotes or "
  2933.                "an integer value in the range 0..65535 or an escaped 3-digit octal value in the range \\000..\\377.";
  2934.  
  2935.     return;
  2936. }
  2937.  
  2938.  
  2939. void SemanticError::PrintINVALID_INT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2940. {
  2941.     Coutput << "The value of an \"int\" literal must be a decimal value in the range -2147483648..2147483647"
  2942.                " or a hexadecimal or octal literal that fits in 32 bits.";
  2943.  
  2944.     return;
  2945. }
  2946.  
  2947.  
  2948. void SemanticError::PrintINVALID_LONG_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2949. {
  2950.     Coutput << "The value of a long literal must be a decimal value in the range "
  2951.                "-9223372036854775808..9223372036854775807 or a hexadecimal or octal literal that fits in 64 bits.";
  2952.  
  2953.     return;
  2954. }
  2955.  
  2956.  
  2957. void SemanticError::PrintINVALID_FLOAT_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2958. {
  2959.     Coutput << "Invalid floating-point constant.";
  2960.  
  2961.     return;
  2962. }
  2963.  
  2964.  
  2965. void SemanticError::PrintINVALID_DOUBLE_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2966. {
  2967.     Coutput << "Invalid double constant.";
  2968.  
  2969.     return;
  2970. }
  2971.  
  2972.  
  2973. void SemanticError::PrintINVALID_STRING_VALUE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2974. {
  2975.     Coutput << "The value of this \"String\" literal is invalid. Perhaps it contains a bad escape sequence?";
  2976.  
  2977.     return;
  2978. }
  2979.  
  2980.  
  2981. void SemanticError::PrintRETURN_STATEMENT_IN_INITIALIZER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2982. {
  2983.     Coutput << "A return statement may not appear in an initializer block.";
  2984.  
  2985.     return;
  2986. }
  2987.  
  2988.  
  2989. void SemanticError::PrintMISPLACED_RETURN_WITH_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2990. {
  2991.     Coutput << "A return statement with expression must be contained in a method declaration that is "
  2992.                "declared to return a value.";
  2993.  
  2994.     return;
  2995. }
  2996.  
  2997.  
  2998. void SemanticError::PrintMISPLACED_RETURN_WITH_NO_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  2999. {
  3000.     Coutput << "A return statement with no expression may only appear in void method or a constructor.";
  3001.  
  3002.     return;
  3003. }
  3004.  
  3005.  
  3006. void SemanticError::PrintMISMATCHED_RETURN_AND_METHOD_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3007. {
  3008.     Coutput << "The type of this return expression, \"";
  3009.     if (NotDot(err.insert1))
  3010.     {
  3011.         Coutput << err.insert1
  3012.                 << '/';
  3013.     }
  3014.     Coutput << err.insert2
  3015.             << "\", does not match the return type of the method, \"";
  3016.     if (NotDot(err.insert3))
  3017.     {
  3018.         Coutput << err.insert3
  3019.                 << '/';
  3020.     }
  3021.     Coutput << err.insert4
  3022.             << "\".";
  3023.  
  3024.     return;
  3025. }
  3026.  
  3027.  
  3028. void SemanticError::PrintEXPRESSION_NOT_THROWABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3029. {
  3030.     Coutput << "The expression in a throw statement must denote a variable or value of a reference type "
  3031.                "which is assignable to the type Throwable.";
  3032.  
  3033.     return;
  3034. }
  3035.  
  3036.  
  3037. void SemanticError::PrintBAD_THROWABLE_EXPRESSION_IN_TRY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3038. {
  3039.     Coutput << "The type of the expression in this throw statement, \"";
  3040.     if (NotDot(err.insert1))
  3041.     {
  3042.         Coutput << err.insert1
  3043.                 << '/';
  3044.     }
  3045.     Coutput << err.insert2
  3046.             << "\", is not catchable by the enclosing try statement;";
  3047.     if (wcslen(err.insert3) > 0)
  3048.     {
  3049.         Coutput << " nor is it assignable to an exception in the throws clause of the enclosing method or constructor \""
  3050.                 << err.insert3
  3051.                 << "\";";
  3052.     }
  3053.     Coutput << " nor is it a subclass of RuntimeException or Error.";
  3054.  
  3055.     return;
  3056. }
  3057.  
  3058.  
  3059. void SemanticError::PrintBAD_THROWABLE_EXPRESSION_IN_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3060. {
  3061.     Coutput << "The type of the expression in this throw statement, \"";
  3062.     if (NotDot(err.insert1))
  3063.     {
  3064.         Coutput << err.insert1
  3065.                 << '/';
  3066.     }
  3067.     Coutput << err.insert2
  3068.             << "\", is not assignable to an exception in the throws clause of the enclosing method or constructor \""
  3069.             << err.insert3
  3070.             << "\"; nor is it a subclass of RuntimeException or Error.";
  3071.  
  3072.     return;
  3073. }
  3074.  
  3075.  
  3076. void SemanticError::PrintBAD_THROWABLE_EXPRESSION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3077. {
  3078.     Coutput << "The type of the expression in this throw statement, \"";
  3079.     if (NotDot(err.insert1))
  3080.     {
  3081.         Coutput << err.insert1
  3082.                 << '/';
  3083.     }
  3084.     Coutput << err.insert2
  3085.             << "\", is not a subclass of RuntimeException or Error.";
  3086.  
  3087.     return;
  3088. }
  3089.  
  3090.  
  3091. void SemanticError::PrintMISPLACED_BREAK_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3092. {
  3093.     Coutput << "A \"break\" statement must be enclosed in a \"switch\", \"while\", \"do\" or \"for\" statement.";
  3094.  
  3095.     return;
  3096. }
  3097.  
  3098.  
  3099. void SemanticError::PrintMISPLACED_CONTINUE_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3100. {
  3101.     Coutput << "A \"continue\" statement must be enclosed in a \"while\", \"do\" or \"for\" statement.";
  3102.  
  3103.     return;
  3104. }
  3105.  
  3106.  
  3107. void SemanticError::PrintMISPLACED_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3108. {
  3109.     Coutput << "Misplaced explicit constructor invocation.";
  3110.  
  3111.     return;
  3112. }
  3113.  
  3114.  
  3115. void SemanticError::PrintINVALID_CONTINUE_TARGET(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3116. {
  3117.     Coutput << "The statement labeled \""
  3118.             << err.insert1
  3119.             << "\" cannot be continued since it is not a \"while\", \"do\" or \"for\" statement.";
  3120.  
  3121.     return;
  3122. }
  3123.  
  3124.  
  3125. void SemanticError::PrintNON_ABSTRACT_TYPE_CONTAINS_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3126. {
  3127.     Coutput << "The abstract method \""
  3128.             << err.insert1
  3129.             << "\" is enclosed in a type, \""
  3130.             << err.insert2
  3131.             << "\", that is not abstract.";
  3132.  
  3133.     return;
  3134. }
  3135.  
  3136.  
  3137. void SemanticError::PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3138. {
  3139.     Coutput << "The abstract method \""
  3140.             << err.insert1
  3141.             << "\", inherited from type \"";
  3142.     if (NotDot(err.insert2))
  3143.     {
  3144.         Coutput << err.insert2
  3145.                 << '/';
  3146.     }
  3147.     Coutput << err.insert3
  3148.             << "\", is not implemented in the non-abstract class \"";
  3149.     if (NotDot(err.insert4))
  3150.     {
  3151.         Coutput << err.insert4
  3152.                 << '/';
  3153.     }
  3154.     Coutput << err.insert5
  3155.             << "\".";
  3156.  
  3157.     return;
  3158. }
  3159.  
  3160.  
  3161. void SemanticError::PrintNON_ABSTRACT_TYPE_INHERITS_ABSTRACT_METHOD_FROM_ABSTRACT_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3162. {
  3163.     Coutput << "The abstract method \""
  3164.             << err.insert1
  3165.             << "\", inherited from type \"";
  3166.     if (NotDot(err.insert2))
  3167.     {
  3168.         Coutput << err.insert2
  3169.                 << '/';
  3170.     }
  3171.     Coutput << err.insert3
  3172.             << "\", is not implemented in the non-abstract class \"";
  3173.     if (NotDot(err.insert4))
  3174.     {
  3175.         Coutput << err.insert4
  3176.                 << '/';
  3177.     }
  3178.     Coutput << err.insert5
  3179.             << "\". Since the type \"";
  3180.     if (NotDot(err.insert2))
  3181.     {
  3182.         Coutput << err.insert2
  3183.                 << '/';
  3184.     }
  3185.     Coutput << err.insert3
  3186.             << "\" was read from a class file, it is possible that it just needs to be recompiled "
  3187.                "because after having inherited method \""
  3188.             << err.insert1
  3189.             << "\" from an interface, the method was subsequently removed from that interface.";
  3190.  
  3191.     return;
  3192. }
  3193.  
  3194.  
  3195. void SemanticError::PrintNON_ABSTRACT_TYPE_CANNOT_OVERRIDE_DEFAULT_ABSTRACT_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3196. {
  3197.     Coutput << "The abstract method \""
  3198.             << err.insert1
  3199.             << "\", belonging to the class \"";
  3200.     if (NotDot(err.insert2))
  3201.     {
  3202.         Coutput << err.insert2
  3203.                 << '/';
  3204.     }
  3205.     Coutput << err.insert3
  3206.             << "\" has default access."
  3207.                " Therefore, it is not inherited and hence, it cannot be implemented in the non-abstract class \"";
  3208.     if (NotDot(err.insert4))
  3209.     {
  3210.         Coutput << err.insert4
  3211.                 << '/';
  3212.     }
  3213.     Coutput << err.insert5
  3214.             << "\".";
  3215.  
  3216.     return;
  3217. }
  3218.  
  3219.  
  3220. void SemanticError::PrintNO_ABSTRACT_METHOD_IMPLEMENTATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3221. {
  3222.     Coutput << "No implementation of the abstract method \""
  3223.             << err.insert1
  3224.             << "\" declared in type \"";
  3225.     if (NotDot(err.insert2))
  3226.     {
  3227.         Coutput << err.insert2
  3228.                 << '/';
  3229.     }
  3230.     Coutput << err.insert3
  3231.             << "\" was found in class \""
  3232.             << err.insert4
  3233.             << "\".";
  3234.  
  3235.     return;
  3236. }
  3237.  
  3238.  
  3239. void SemanticError::PrintDUPLICATE_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3240. {
  3241.     Coutput << "Duplicate specification of interface \"";
  3242.     if (NotDot(err.insert1))
  3243.     {
  3244.         Coutput << err.insert1
  3245.                 << '/';
  3246.     }
  3247.     Coutput << err.insert2
  3248.             << "\" in definition of type \""
  3249.             << err.insert3
  3250.             << "\".";
  3251.  
  3252.     return;
  3253. }
  3254.  
  3255.  
  3256. void SemanticError::PrintUNKNOWN_QUALIFIED_NAME_BASE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3257. {
  3258.     Coutput << "\""
  3259.             << err.insert1
  3260.             << "\" is either a misplaced package name or a non-existent entity.";
  3261.  
  3262.     return;
  3263. }
  3264.  
  3265.  
  3266. void SemanticError::PrintUNKNOWN_AMBIGUOUS_NAME(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3267. {
  3268.     Coutput << "\""
  3269.             << err.insert1
  3270.             << "\" is either a misplaced package name or a non-existent entity. An expression name is expected in this context.";
  3271.  
  3272.     return;
  3273. }
  3274.  
  3275.  
  3276. void SemanticError::PrintCIRCULAR_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3277. {
  3278.     Coutput << "The class \"";
  3279.     if (NotDot(err.insert1))
  3280.     {
  3281.         Coutput << err.insert1
  3282.                 << "/";
  3283.     }
  3284.     Coutput << err.insert2
  3285.             << "\" is circularly defined with its super type(s).";
  3286.  
  3287.     return;
  3288. }
  3289.  
  3290.  
  3291. void SemanticError::PrintCIRCULAR_INTERFACE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3292. {
  3293.     Coutput << "The interface \"";
  3294.     if (NotDot(err.insert1))
  3295.     {
  3296.         Coutput << err.insert1
  3297.                 << "/";
  3298.     }
  3299.     Coutput << err.insert2
  3300.             << "\" is circularly defined with its super type(s).";
  3301.  
  3302.     return;
  3303. }
  3304.  
  3305.  
  3306. void SemanticError::PrintTYPE_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3307. {
  3308.     Coutput << "The type \"";
  3309.     if (NotDot(err.insert1))
  3310.     {
  3311.         Coutput << err.insert1
  3312.                 << '/';
  3313.     }
  3314.     Coutput << err.insert2
  3315.             << "\" with "
  3316.             << err.insert3
  3317.             << " access is not visible here.";
  3318.  
  3319.     return;
  3320. }
  3321.  
  3322.  
  3323. void SemanticError::PrintPRIVATE_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3324. {
  3325.     Coutput << "The field \""
  3326.             << err.insert1
  3327.             << "\" in type \"";
  3328.     if (NotDot(err.insert2))
  3329.     {
  3330.         Coutput << err.insert2
  3331.                 << '/';
  3332.     }
  3333.     Coutput << err.insert3
  3334.             << "\" is private and not accessible here.";
  3335.  
  3336.     return;
  3337. }
  3338.  
  3339.  
  3340. void SemanticError::PrintPROTECTED_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3341. {
  3342.     Coutput << "The field \""
  3343.             << err.insert1
  3344.             << "\" in type \"";
  3345.     if (NotDot(err.insert2))
  3346.     {
  3347.         Coutput << err.insert2
  3348.                 << '/';
  3349.     }
  3350.     Coutput << err.insert3
  3351.             << "\" is protected and not accessible here.";
  3352.  
  3353.     return;
  3354. }
  3355.  
  3356.  
  3357. void SemanticError::PrintDEFAULT_FIELD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3358. {
  3359.     Coutput << "The field \""
  3360.             << err.insert1
  3361.             << "\" in type \"";
  3362.     if (NotDot(err.insert2))
  3363.     {
  3364.         Coutput << err.insert2
  3365.                 << '/';
  3366.     }
  3367.     Coutput << err.insert3
  3368.             << "\" has default access and is not accessible here.";
  3369.  
  3370.     return;
  3371. }
  3372.  
  3373.  
  3374. void SemanticError::PrintPRIVATE_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3375. {
  3376.     Coutput << "Method \""
  3377.             << err.insert1
  3378.             << "\" in type \"";
  3379.     if (NotDot(err.insert2))
  3380.     {
  3381.         Coutput << err.insert2
  3382.                 << '/';
  3383.     }
  3384.     Coutput << err.insert3
  3385.             << "\" is private and not accessible here.";
  3386.  
  3387.     return;
  3388. }
  3389.  
  3390.  
  3391. void SemanticError::PrintPROTECTED_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3392. {
  3393.     Coutput << "Method \""
  3394.             << err.insert1
  3395.             << "\" in type \"";
  3396.     if (NotDot(err.insert2))
  3397.     {
  3398.         Coutput << err.insert2
  3399.                 << '/';
  3400.     }
  3401.     Coutput << err.insert3
  3402.             << "\" is protected and not accessible here.";
  3403.  
  3404.     return;
  3405. }
  3406.  
  3407.  
  3408. void SemanticError::PrintDEFAULT_METHOD_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3409. {
  3410.     Coutput << "Method \""
  3411.             << err.insert1
  3412.             << "\" in type \"";
  3413.     if (NotDot(err.insert2))
  3414.     {
  3415.         Coutput << err.insert2
  3416.                 << '/';
  3417.     }
  3418.     Coutput << err.insert3
  3419.             << "\" has default access and is not accessible here.";
  3420.  
  3421.     return;
  3422. }
  3423.  
  3424.  
  3425. void SemanticError::PrintPRIVATE_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3426. {
  3427.     Coutput << "The constructor \""
  3428.             << err.insert1
  3429.             << "\" in type \"";
  3430.     if (NotDot(err.insert2))
  3431.     {
  3432.         Coutput << err.insert2
  3433.                 << '/';
  3434.     }
  3435.     Coutput << err.insert3
  3436.             << "\" is private. Therefore, it is not accessible here.";
  3437.  
  3438.     return;
  3439. }
  3440.  
  3441.  
  3442. void SemanticError::PrintPROTECTED_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3443. {
  3444.     Coutput << "The constructor \""
  3445.             << err.insert1
  3446.             << "\" in type \"";
  3447.     if (NotDot(err.insert2))
  3448.     {
  3449.         Coutput << err.insert2
  3450.                 << '/';
  3451.     }
  3452.     Coutput << err.insert3
  3453.             << "\" is protected. Therefore, it is not accessible here.";
  3454.  
  3455.     return;
  3456. }
  3457.  
  3458.  
  3459. void SemanticError::PrintDEFAULT_CONSTRUCTOR_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3460. {
  3461.     Coutput << "The constructor \""
  3462.             << err.insert1
  3463.             << "\" in type \"";
  3464.     if (NotDot(err.insert2))
  3465.     {
  3466.         Coutput << err.insert2
  3467.                 << '/';
  3468.     }
  3469.     Coutput << err.insert3
  3470.             << "\" has default access. Therefore, it is not accessible here.";
  3471.  
  3472.     return;
  3473. }
  3474.  
  3475.  
  3476. void SemanticError::PrintCONSTRUCTOR_DOES_NOT_THROW_THIS_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3477. {
  3478.     Coutput << "The constructor invoked here can throw the exception \"";
  3479.     if (NotDot(err.insert1))
  3480.     {
  3481.         Coutput << err.insert1
  3482.                 << "/";
  3483.     }
  3484.     Coutput << err.insert2
  3485.             << "\" which is not thrown by the constructor containing this call.";
  3486.  
  3487.     return;
  3488. }
  3489.  
  3490.  
  3491. void SemanticError::PrintCONSTRUCTOR_DOES_NOT_THROW_SUPER_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3492. {
  3493.     Coutput << "A constructor associated with this ";
  3494.  
  3495.     if (wcslen(err.insert1) == 0)
  3496.         Coutput << "anonymous type";
  3497.     else
  3498.     {
  3499.         Coutput << "type, \""
  3500.                 << err.insert1
  3501.                 << "\",";
  3502.     }
  3503.  
  3504.     Coutput << " does not throw the exception \"";
  3505.     if (NotDot(err.insert2))
  3506.     {
  3507.         Coutput << err.insert2
  3508.                 << "/";
  3509.     }
  3510.     Coutput << err.insert3
  3511.             << "\" thrown by its super type, \"";
  3512.     if (NotDot(err.insert4))
  3513.     {
  3514.         Coutput << err.insert4
  3515.                 << "/";
  3516.     }
  3517.     Coutput << err.insert5
  3518.             << "\".";
  3519.  
  3520.     return;
  3521. }
  3522.  
  3523.  
  3524. void SemanticError::PrintPARAMETER_REDECLARED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3525. {
  3526.     Coutput << "The name of a formal parameter, \""
  3527.             << err.insert1
  3528.             << "\", may not be used to declare a local variable or an exception parameter.";
  3529.  
  3530.     return;
  3531. }
  3532.  
  3533.  
  3534. void SemanticError::PrintBAD_ABSTRACT_METHOD_MODIFIER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3535. {
  3536.     Coutput << "A method declaration that contains the keyword \"abstract\" may not also contain one of the keywords: "
  3537.                "\"private\", \"static\", \"final\", \"native\" or \"synchronized\".";
  3538.  
  3539.     return;
  3540. }
  3541.  
  3542.  
  3543. void SemanticError::PrintABSTRACT_METHOD_MODIFIER_CONFLICT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3544. {
  3545.     Coutput << "An abstract method may not also contain the keyword \""
  3546.             << err.insert1
  3547.             << "\".";
  3548.  
  3549.     return;
  3550. }
  3551.  
  3552.  
  3553. void SemanticError::PrintABSTRACT_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3554. {
  3555.     Coutput << "An abstract method, \""
  3556.             << err.insert1
  3557.             << "\", cannot be invoked.";
  3558.  
  3559.     return;
  3560. }
  3561.  
  3562.  
  3563. void SemanticError::PrintFINAL_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3564. {
  3565.     Coutput << "The method \""
  3566.             << err.insert1
  3567.             << "\" cannot override the final (or private) method \""
  3568.             << err.insert2
  3569.             << "\" declared in type \"";
  3570.     if (NotDot(err.insert3))
  3571.     {
  3572.         Coutput << err.insert3
  3573.                 << "/";
  3574.     }
  3575.     Coutput << err.insert4
  3576.             << "\".";
  3577.  
  3578.     return;
  3579. }
  3580.  
  3581.  
  3582. void SemanticError::PrintFINAL_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3583. {
  3584.     Coutput << "In class \""
  3585.             << err.insert1
  3586.             << "\", the method \""
  3587.             << err.insert2
  3588.             << "\", inherited from type \"";
  3589.     if (NotDot(err.insert3))
  3590.     {
  3591.         Coutput << err.insert3
  3592.                 << "/";
  3593.     }
  3594.     Coutput << err.insert4
  3595.             << "\", overrides the final (or private) method \""
  3596.             << err.insert5
  3597.             << "\", inherited from type \"";
  3598.     if (NotDot(err.insert6))
  3599.     {
  3600.         Coutput << err.insert6
  3601.                 << "/";
  3602.     }
  3603.     Coutput << err.insert7
  3604.             << "\".";
  3605.  
  3606.     return;
  3607. }
  3608.  
  3609.  
  3610. void SemanticError::PrintPRIVATE_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3611. {
  3612.     Coutput << "The method \""
  3613.             << err.insert1
  3614.             << "\" is overriding the private (should be treated as final) method \""
  3615.             << err.insert2
  3616.             << "\" declared in type \"";
  3617.     if (NotDot(err.insert3))
  3618.     {
  3619.         Coutput << err.insert3
  3620.                 << "/";
  3621.     }
  3622.     Coutput << err.insert4
  3623.             << "\".";
  3624.  
  3625.     return;
  3626. }
  3627.  
  3628.  
  3629. void SemanticError::PrintPRIVATE_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3630. {
  3631.     Coutput << "In class \""
  3632.             << err.insert1
  3633.             << "\", the method \""
  3634.             << err.insert2
  3635.             << "\", inherited from type \"";
  3636.     if (NotDot(err.insert3))
  3637.     {
  3638.         Coutput << err.insert3
  3639.                 << "/";
  3640.     }
  3641.     Coutput << err.insert4
  3642.             << "\", overrides the private (should be treated as final) method \""
  3643.             << err.insert5
  3644.             << "\", inherited from type \"";
  3645.     if (NotDot(err.insert6))
  3646.     {
  3647.         Coutput << err.insert6
  3648.                 << "/";
  3649.     }
  3650.     Coutput << err.insert7
  3651.             << "\".";
  3652.  
  3653.     return;
  3654. }
  3655.  
  3656.  
  3657. void SemanticError::PrintCLASS_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3658. {
  3659.     Coutput << "The instance method \""
  3660.             << err.insert1
  3661.             << "\" cannot override the static method \""
  3662.             << err.insert2
  3663.             << "\" declared in type \"";
  3664.     if (NotDot(err.insert3))
  3665.     {
  3666.         Coutput << err.insert3
  3667.                 << "/";
  3668.     }
  3669.     Coutput << err.insert4
  3670.             << "\".";
  3671.  
  3672.     return;
  3673. }
  3674.  
  3675.  
  3676. void SemanticError::PrintCLASS_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3677. {
  3678.     Coutput << "In class \""
  3679.             << err.insert1
  3680.             << "\", the instance method \""
  3681.             << err.insert2
  3682.             << "\", inherited from type \"";
  3683.     if (NotDot(err.insert3))
  3684.     {
  3685.         Coutput << err.insert3
  3686.                 << "/";
  3687.     }
  3688.     Coutput << err.insert4
  3689.             << "\", cannot override the static method \""
  3690.             << err.insert5
  3691.             << "\", declared in type \"";
  3692.     if (NotDot(err.insert6))
  3693.     {
  3694.         Coutput << err.insert6
  3695.                 << "/";
  3696.     }
  3697.     Coutput << err.insert7
  3698.             << "\".";
  3699.  
  3700.     return;
  3701. }
  3702.  
  3703.  
  3704. void SemanticError::PrintINSTANCE_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3705. {
  3706.     Coutput << "The static method \""
  3707.             << err.insert1
  3708.             << "\" cannot hide the instance method \""
  3709.             << err.insert2
  3710.             << "\" declared in \"";
  3711.     if (NotDot(err.insert3))
  3712.     {
  3713.         Coutput << err.insert3
  3714.                 << "/";
  3715.     }
  3716.     Coutput << err.insert4
  3717.             << "\".";
  3718.  
  3719.     return;
  3720. }
  3721.  
  3722.  
  3723. void SemanticError::PrintINSTANCE_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3724. {
  3725.     Coutput << "In class \""
  3726.             << err.insert1
  3727.             << "\", the static method \""
  3728.             << err.insert2
  3729.             << "\", inherited from type \"";
  3730.     if (NotDot(err.insert3))
  3731.     {
  3732.         Coutput << err.insert3
  3733.                 << "/";
  3734.     }
  3735.     Coutput << err.insert4
  3736.             << "\", hides the instance method \""
  3737.             << err.insert5
  3738.             << "\", declared in type \"";
  3739.     if (NotDot(err.insert6))
  3740.     {
  3741.         Coutput << err.insert6
  3742.                 << "/";
  3743.     }
  3744.     Coutput << err.insert7
  3745.             << "\".";
  3746.  
  3747.     return;
  3748. }
  3749.  
  3750.  
  3751. void SemanticError::PrintBAD_ACCESS_METHOD_OVERRIDE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3752. {
  3753.     Coutput << "The method \""
  3754.             << err.insert1
  3755.             << "\" with "
  3756.             << err.insert2
  3757.             << " access cannot override the method \""
  3758.             << err.insert3
  3759.             << "\" with "
  3760.             << err.insert4
  3761.             << " access declared in type \"";
  3762.     if (NotDot(err.insert5))
  3763.     {
  3764.         Coutput << err.insert5
  3765.                 << "/";
  3766.     }
  3767.     Coutput << err.insert6
  3768.             << "\".";
  3769.  
  3770.     return;
  3771. }
  3772.  
  3773.  
  3774. void SemanticError::PrintBAD_ACCESS_METHOD_OVERRIDE_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3775. {
  3776.     Coutput << "In class \""
  3777.             << err.insert1
  3778.             << "\", the method \""
  3779.             << err.insert2
  3780.             << "\" with "
  3781.             << err.insert3
  3782.             << " access inherited from type \"";
  3783.     if (NotDot(err.insert4))
  3784.     {
  3785.         Coutput << err.insert4
  3786.                 << "/";
  3787.     }
  3788.     Coutput << err.insert5
  3789.             << "\", cannot override the method \""
  3790.             << err.insert6
  3791.             << "\" with "
  3792.             << err.insert7
  3793.             << " access inherited from type \"";
  3794.     if (NotDot(err.insert8))
  3795.     {
  3796.         Coutput << err.insert8
  3797.                 << "/";
  3798.     }
  3799.     Coutput << err.insert9
  3800.             << "\".";
  3801.  
  3802.     return;
  3803. }
  3804.  
  3805.  
  3806. void SemanticError::PrintMISMATCHED_OVERRIDDEN_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3807. {
  3808.     Coutput << "The exception \""
  3809.             << err.insert1
  3810.             << "\" is not the same as or a subclass of any exception in the throws clause of the overridden method \""
  3811.             << err.insert2
  3812.             << "\" declared in type \"";
  3813.     if (NotDot(err.insert3))
  3814.     {
  3815.         Coutput << err.insert3
  3816.                 << "/";
  3817.     }
  3818.     Coutput << err.insert4
  3819.             << "\".";
  3820.  
  3821.     return;
  3822. }
  3823.  
  3824.  
  3825. void SemanticError::PrintMISMATCHED_OVERRIDDEN_EXCEPTION_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3826. {
  3827.     Coutput << "In class \""
  3828.             << err.insert1
  3829.             << "\", the exception \""
  3830.             << err.insert2
  3831.             << "\" specified in method \""
  3832.             << err.insert3
  3833.             << "\" inherited from type \"";
  3834.     if (NotDot(err.insert4))
  3835.     {
  3836.         Coutput << err.insert4
  3837.                 << "/";
  3838.     }
  3839.     Coutput << err.insert5
  3840.             << "\", is not the same as or a subclass of any exception in the throws clause of the overridden method \""
  3841.             << err.insert6
  3842.             << "\" declared in type \"";
  3843.     if (NotDot(err.insert7))
  3844.     {
  3845.         Coutput << err.insert7
  3846.                 << "/";
  3847.     }
  3848.     Coutput << err.insert8
  3849.             << "\".";
  3850.  
  3851.     return;
  3852. }
  3853.  
  3854.  
  3855. void SemanticError::PrintABSTRACT_METHOD_WITH_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3856. {
  3857.     Coutput << "The declaration of the abstract or native method, \""
  3858.             << err.insert1
  3859.             << "\", must not contain a method body.";
  3860.  
  3861.     return;
  3862. }
  3863.  
  3864.  
  3865. void SemanticError::PrintNON_ABSTRACT_METHOD_WITHOUT_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3866. {
  3867.     Coutput << "The declaration of the non-abstract and non-native method, \""
  3868.             << err.insert1
  3869.             << "\", must contain a method body.";
  3870.  
  3871.     return;
  3872. }
  3873.  
  3874.  
  3875. void SemanticError::PrintSTATIC_OVERRIDE_ABSTRACT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3876. {
  3877.     Coutput << "The static method \""
  3878.             << err.insert1
  3879.             << "\" cannot hide an abstract method of the same name declared in type \"";
  3880.     if (NotDot(err.insert2))
  3881.     {
  3882.         Coutput << err.insert2
  3883.                 << "/";
  3884.     }
  3885.     Coutput << err.insert3
  3886.             << "\".";
  3887.  
  3888.     return;
  3889. }
  3890.  
  3891.  
  3892. void SemanticError::PrintSTATIC_OVERRIDE_ABSTRACT_EXTERNALLY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3893. {
  3894.     Coutput << "In class \""
  3895.             << err.insert1
  3896.             << "\", the static method \""
  3897.             << err.insert2
  3898.             << "\", inherited from type \"";
  3899.     if (NotDot(err.insert3))
  3900.     {
  3901.         Coutput << err.insert3
  3902.                 << "/";
  3903.     }
  3904.     Coutput << err.insert4
  3905.             << "\", cannot hide the abstract method \""
  3906.             << err.insert5
  3907.             << "\", inherited from type \"";
  3908.     if (NotDot(err.insert6))
  3909.     {
  3910.         Coutput << err.insert6
  3911.                 << "/";
  3912.     }
  3913.     Coutput << err.insert7
  3914.             << "\".";
  3915.  
  3916.     return;
  3917. }
  3918.  
  3919.  
  3920. void SemanticError::PrintCIRCULAR_THIS_CALL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3921. {
  3922.     Coutput << "The constructor \""
  3923.             << err.insert1
  3924.             << "\" may not directly or indirectly invoke itself.";
  3925.  
  3926.     return;
  3927. }
  3928.  
  3929.  
  3930. void SemanticError::PrintINSTANCE_VARIABLE_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3931. {
  3932.     Coutput << "The instance variable \""
  3933.             << err.insert1
  3934.             << "\" declared in class \""
  3935.             << err.insert2
  3936.             << "\" is not accessible in an explicit constructor invocation.";
  3937.  
  3938.     return;
  3939. }
  3940.  
  3941.  
  3942. void SemanticError::PrintINSTANCE_METHOD_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3943. {
  3944.     Coutput << "The instance method \""
  3945.             << err.insert1
  3946.             << "\" declared in this class, \""
  3947.             << err.insert2
  3948.             << "\", or one of its super classes, is not accessible in an explicit constructor invocation.";
  3949.  
  3950.     return;
  3951. }
  3952.  
  3953.  
  3954. void SemanticError::PrintSYNTHETIC_VARIABLE_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3955. {
  3956.     Coutput << "Illegal attempt to access the synthetic field \""
  3957.             << err.insert1
  3958.             << "\" contained in class \"";
  3959.     if (NotDot(err.insert2))
  3960.     {
  3961.         Coutput << err.insert2
  3962.                 << "/";
  3963.     }
  3964.     Coutput << err.insert3
  3965.             << "\".";
  3966.  
  3967.     return;
  3968. }
  3969.  
  3970.  
  3971. void SemanticError::PrintSYNTHETIC_METHOD_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3972. {
  3973.     Coutput << "Illegal attempt to invoke the synthetic method \""
  3974.             << err.insert1
  3975.             << "\" contained in class \"";
  3976.     if (NotDot(err.insert2))
  3977.     {
  3978.         Coutput << err.insert2
  3979.                 << "/";
  3980.     }
  3981.     Coutput << err.insert3
  3982.             << "\".";
  3983.  
  3984.     return;
  3985. }
  3986.  
  3987.  
  3988. void SemanticError::PrintSYNTHETIC_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  3989. {
  3990.     Coutput << "Illegal attempt to invoke the synthetic constructor \""
  3991.             << err.insert1
  3992.             << "\" from class \"";
  3993.     if (NotDot(err.insert2))
  3994.     {
  3995.         Coutput << err.insert2
  3996.                 << "/";
  3997.     }
  3998.     Coutput << err.insert3
  3999.             << "\".";
  4000.  
  4001.     return;
  4002. }
  4003.  
  4004.  
  4005. void SemanticError::PrintTHIS_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4006. {
  4007.     Coutput << "The expression \""
  4008.             << err.insert1
  4009.             << "\" may not be used in an explicit constructor invocation.";
  4010.  
  4011.     return;
  4012. }
  4013.  
  4014.  
  4015. void SemanticError::PrintSUPER_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4016. {
  4017.     Coutput << "The expression \""
  4018.             << err.insert1
  4019.             << "\" may not be used in an explicit constructor invocation.";
  4020.  
  4021.     return;
  4022. }
  4023.  
  4024.  
  4025. void SemanticError::PrintINNER_CONSTRUCTOR_IN_EXPLICIT_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4026. {
  4027.     Coutput << "The constructor for class \"";
  4028.     if (NotDot(err.insert1))
  4029.     {
  4030.         Coutput << err.insert1
  4031.                 << "/";
  4032.     }
  4033.     Coutput << err.insert2
  4034.             << "\" is not accessible from an explicit constructor invocation in the immediately enclosing class \"";
  4035.     if (NotDot(err.insert3))
  4036.     {
  4037.         Coutput << err.insert3
  4038.                 << "/";
  4039.     }
  4040.     Coutput << err.insert4
  4041.             << "\".";
  4042.  
  4043.     return;
  4044. }
  4045.  
  4046.  
  4047. void SemanticError::PrintEXPRESSION_NOT_CONSTANT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4048. {
  4049.     Coutput << "A constant expression is expected in this context.";
  4050.  
  4051.     return;
  4052. }
  4053.  
  4054.  
  4055. void SemanticError::PrintUNCATCHABLE_METHOD_THROWN_CHECKED_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4056. {
  4057.     Coutput << "The method \""
  4058.             << err.insert1
  4059.             << "\" can throw the checked exception \"";
  4060.     if (NotDot(err.insert2))
  4061.     {
  4062.         Coutput << err.insert2
  4063.                 << "/";
  4064.     }
  4065.     Coutput << err.insert3
  4066.             << "\", but its invocation is neither enclosed in a try statement that can catch "
  4067.                "that exception nor in the body of a method or constructor that \"throws\" that exception.";
  4068.  
  4069.     return;
  4070. }
  4071.  
  4072.  
  4073. void SemanticError::PrintUNCATCHABLE_CONSTRUCTOR_THROWN_CHECKED_EXCEPTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4074. {
  4075.     Coutput << "The constructor \""
  4076.             << err.insert1
  4077.             << "\" can throw the checked exception \"";
  4078.     if (NotDot(err.insert2))
  4079.     {
  4080.         Coutput << err.insert2
  4081.                 << "/";
  4082.     }
  4083.     Coutput << err.insert3
  4084.             << "\", but its invocation is neither enclosed in a try statement that can catch "
  4085.                "that exception nor in the body of a method or constructor that \"throws\" that exception.";
  4086.  
  4087.     return;
  4088. }
  4089.  
  4090.  
  4091. void SemanticError::PrintUNREACHABLE_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4092. {
  4093.     Coutput << "This catch block may be unreachable because there is no exception "
  4094.                "whose type is assignable to \"";
  4095.     if (NotDot(err.insert1))
  4096.     {
  4097.         Coutput << err.insert1
  4098.                 << "/";
  4099.     }
  4100.     Coutput << err.insert2
  4101.             << "\" that can be thrown during execution of the body of the try block.";
  4102.  
  4103.     return;
  4104. }
  4105.  
  4106.  
  4107. void SemanticError::PrintUNREACHABLE_DEFAULT_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4108. {
  4109.     Coutput << "This catch block may be unreachable because there is no exception "
  4110.                "whose type is assignable to \"";
  4111.     if (NotDot(err.insert1))
  4112.     {
  4113.         Coutput << err.insert1
  4114.                 << "/";
  4115.     }
  4116.     Coutput << err.insert2
  4117.             << "\" that can be thrown during execution of the body of the try block."
  4118.                " However, this being a base exception class, compilation will proceed.";
  4119.  
  4120.     return;
  4121. }
  4122.  
  4123.  
  4124. void SemanticError::PrintUNREACHABLE_STATEMENT(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4125. {
  4126.     Coutput << "This statement is unreachable.";
  4127.  
  4128.     return;
  4129. }
  4130.  
  4131.  
  4132. void SemanticError::PrintUNREACHABLE_STATEMENTS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4133. {
  4134.     Coutput << "These statements are unreachable.";
  4135.  
  4136.     return;
  4137. }
  4138.  
  4139.  
  4140. void SemanticError::PrintUNREACHABLE_CONSTRUCTOR_BODY(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4141. {
  4142.     Coutput << "The body of this constructor is unreachable because the last initializer block "
  4143.                "in this class does not complete normally.";
  4144.  
  4145.     return;
  4146. }
  4147.  
  4148.  
  4149. void SemanticError::PrintBLOCKED_CATCH_CLAUSE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4150. {
  4151.     Coutput << "This catch block is unreachable: the exception \"";
  4152.     if (NotDot(err.insert1))
  4153.     {
  4154.         Coutput << err.insert1
  4155.                 << "/";
  4156.     }
  4157.     Coutput << err.insert2
  4158.             << "\" was used in a previous catch clause in this try statement at location "
  4159.             << err.insert3
  4160.             << '.';
  4161.  
  4162.     return;
  4163. }
  4164.  
  4165.  
  4166. void SemanticError::PrintVARIABLE_NOT_DEFINITELY_ASSIGNED(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4167. {
  4168.     Coutput << "The variable \""
  4169.             << err.insert1
  4170.             << "\" may be accessed here before having been definitely assigned a value.";
  4171.  
  4172.     return;
  4173. }
  4174.  
  4175.  
  4176. void SemanticError::PrintTYPED_METHOD_WITH_NO_RETURN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4177. {
  4178.     Coutput << "The method \""
  4179.             << err.insert1
  4180.             << "\" must contain a return statement with an expression compatible with type \""
  4181.             << err.insert2
  4182.             << "\".";
  4183.  
  4184.     return;
  4185. }
  4186.  
  4187.  
  4188. void SemanticError::PrintDEFAULT_METHOD_NOT_OVERRIDDEN(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4189. {
  4190.     Coutput << "Method \""
  4191.             << err.insert1
  4192.             << "\" in class \"";
  4193.     if (NotDot(err.insert2))
  4194.     {
  4195.         Coutput << err.insert2
  4196.                 << "/";
  4197.     }
  4198.     Coutput << err.insert3
  4199.             << "\" does not override the corresponding method with default access in class \"";
  4200.     if (NotDot(err.insert4))
  4201.     {
  4202.         Coutput << err.insert4
  4203.                 << "/";
  4204.     }
  4205.     Coutput << err.insert5
  4206.             << "\".";
  4207.  
  4208.     return;
  4209. }
  4210.  
  4211.  
  4212. void SemanticError::PrintTYPE_NOT_IN_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4213. {
  4214.     Coutput << "The file \""
  4215.             << err.insert1
  4216.             << ".class\" was found in directory \""
  4217.             << err.insert2
  4218.             << "\" specified in the CLASSPATH. However, that class file specifies a type associated with the named package \""
  4219.             << err.insert3
  4220.             << "\" instead of the unnamed package.";
  4221. }
  4222.  
  4223.  
  4224. void SemanticError::PrintTYPE_IN_WRONG_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4225. {
  4226.     Coutput << "The type \""
  4227.             << err.insert1
  4228.             << "\" was found in package \""
  4229.             << err.insert2
  4230.             << "\". However, that type is associated with ";
  4231.     if (wcslen(err.insert3) == 0)
  4232.         Coutput << "the unnamed package";
  4233.     else
  4234.     {
  4235.         Coutput << "another named package, \""
  4236.                 << err.insert3
  4237.                 << "\"";
  4238.     }
  4239.     Coutput << '.';
  4240.  
  4241.     return;
  4242. }
  4243.  
  4244.  
  4245. void SemanticError::PrintTYPE_NAME_MISMATCH(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4246. {
  4247.     Coutput << "The name of the type specified, \"";
  4248.     if (NotDot(err.insert1))
  4249.     {
  4250.         Coutput << err.insert1
  4251.                 << "/";
  4252.     }
  4253.     Coutput << err.insert2
  4254.             << "\", does not match the name found in the class file: \""
  4255.             << err.insert3
  4256.             << "\".";
  4257.  
  4258.     return;
  4259. }
  4260.  
  4261.  
  4262. void SemanticError::PrintDEPRECATED_TYPE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4263. {
  4264.     Coutput << "The type \"";
  4265.     if (NotDot(err.insert1))
  4266.     {
  4267.         Coutput << err.insert1
  4268.                 << "/";
  4269.     }
  4270.     Coutput << err.insert2
  4271.             << "\" has been deprecated.";
  4272.  
  4273.     return;
  4274. }
  4275.  
  4276.  
  4277. void SemanticError::PrintDEPRECATED_FIELD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4278. {
  4279.     Coutput << "The variable \""
  4280.             << err.insert1
  4281.             << "\" declared in type \"";
  4282.     if (NotDot(err.insert2))
  4283.     {
  4284.         Coutput << err.insert2
  4285.                 << "/";
  4286.     }
  4287.     Coutput << err.insert3
  4288.             << "\" has been deprecated.";
  4289.  
  4290.     return;
  4291. }
  4292.  
  4293.  
  4294. void SemanticError::PrintDEPRECATED_METHOD(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4295. {
  4296.     Coutput << "The method \""
  4297.             << err.insert1
  4298.             << "\" declared in type \"";
  4299.     if (NotDot(err.insert2))
  4300.     {
  4301.         Coutput << err.insert2
  4302.                 << "/";
  4303.     }
  4304.     Coutput << err.insert3
  4305.             << "\" has been deprecated.";
  4306.  
  4307.     return;
  4308. }
  4309.  
  4310.  
  4311. void SemanticError::PrintDEPRECATED_CONSTRUCTOR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4312. {
  4313.     Coutput << "The constructor \""
  4314.             << err.insert1
  4315.             << "\" declared in type \"";
  4316.     if (NotDot(err.insert2))
  4317.     {
  4318.         Coutput << err.insert2
  4319.                 << "/";
  4320.     }
  4321.     Coutput << err.insert3
  4322.             << "\" has been deprecated.";
  4323.  
  4324.     return;
  4325. }
  4326.  
  4327.  
  4328. void SemanticError::PrintONE_UNNAMED_PACKAGE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4329. {
  4330.     Coutput << "The type \""
  4331.             << err.insert1
  4332.             << "\" was found in directory \""
  4333.             << err.insert2
  4334.             << "\" specified in the CLASSPATH. It is accessible here only because, by default, this compiler uses "
  4335.                "one unnamed package. In a compiler that associates an unnamed package with each directory "
  4336.                "(as this compiler does with the +P option) this access would be illegal.";
  4337.  
  4338.     return;
  4339. }
  4340.  
  4341.  
  4342.  
  4343. void SemanticError::PrintCOMPRESSED_ZIP_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4344. {
  4345.     Coutput << "The file "
  4346.             << err.insert1
  4347.             << "("
  4348.             << err.insert2
  4349.             << "/"
  4350.             << err.insert3
  4351.             << ") is in an unsupported compressed format. (Unzip and) Rezip \""
  4352.             << err.insert1
  4353.             << "\".";
  4354.  
  4355.     return;
  4356. }
  4357.  
  4358.  
  4359. void SemanticError::PrintINVALID_CLASS_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4360. {
  4361.     Coutput << "The class file \"";
  4362.     if (NotDot(err.insert1))
  4363.     {
  4364.         Coutput << err.insert1
  4365.                 << "/";
  4366.     }
  4367.     Coutput << err.insert2
  4368.             << ".class\" has an invalid format.";
  4369.  
  4370.     return;
  4371. }
  4372.  
  4373.  
  4374. void SemanticError::PrintCANNOT_OPEN_CLASS_FILE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4375. {
  4376.     Coutput << "Unable to open file associated with type \"";
  4377.     if (NotDot(err.insert1))
  4378.     {
  4379.         Coutput << err.insert1
  4380.                 << "/";
  4381.     }
  4382.     Coutput << err.insert2
  4383.             << "\".";
  4384.  
  4385.     return;
  4386. }
  4387.  
  4388.  
  4389. void SemanticError::PrintSTATIC_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4390. {
  4391.     Coutput << "The static class \"";
  4392.     if (NotDot(err.insert1))
  4393.     {
  4394.         Coutput << err.insert1
  4395.                 << "/";
  4396.     }
  4397.     Coutput << err.insert2
  4398.             << "\" is not an inner class.";
  4399.  
  4400.     return;
  4401. }
  4402.  
  4403.  
  4404. void SemanticError::PrintTYPE_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4405. {
  4406.     Coutput << "The type \"";
  4407.     if (NotDot(err.insert1))
  4408.     {
  4409.         Coutput << err.insert1
  4410.                 << "/";
  4411.     }
  4412.     Coutput << err.insert2
  4413.             << "\", is not an inner class that is immediately enclosed in type \"";
  4414.     if (NotDot(err.insert3))
  4415.     {
  4416.         Coutput << err.insert3
  4417.                 << "/";
  4418.     }
  4419.     Coutput << err.insert4
  4420.             << "\".";
  4421.  
  4422.     return;
  4423. }
  4424.  
  4425.  
  4426. void SemanticError::PrintSUPER_TYPE_NOT_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4427. {
  4428.     Coutput << "The super type \"";
  4429.     if (NotDot(err.insert1))
  4430.     {
  4431.         Coutput << err.insert1
  4432.                 << "/";
  4433.     }
  4434.     Coutput << err.insert2
  4435.             << "\" of this type, \"";
  4436.     if (NotDot(err.insert3))
  4437.     {
  4438.         Coutput << err.insert3
  4439.                 << "/";
  4440.     }
  4441.     Coutput << err.insert4
  4442.             << "\", is not an inner class that is immediately enclosed in type \"";
  4443.     if (NotDot(err.insert5))
  4444.     {
  4445.         Coutput << err.insert5
  4446.                 << "/";
  4447.     }
  4448.     Coutput << err.insert6
  4449.             << "\".";
  4450.  
  4451.     return;
  4452. }
  4453.  
  4454.  
  4455. void SemanticError::PrintSTATIC_FIELD_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4456. {
  4457.     Coutput << "An inner class may not contain a static field that is not final.";
  4458.  
  4459.     return;
  4460. }
  4461.  
  4462.  
  4463. void SemanticError::PrintSTATIC_METHOD_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4464. {
  4465.     Coutput << "Inner class may not contain static method.";
  4466.  
  4467.     return;
  4468. }
  4469.  
  4470.  
  4471. void SemanticError::PrintSTATIC_TYPE_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4472. {
  4473.     Coutput << "The static type \""
  4474.             << err.insert1
  4475.             << "\" is enclosed in an inner class, \""
  4476.             << err.insert2
  4477.             << "\", located at "
  4478.             << err.insert3
  4479.             << '.';
  4480.  
  4481.     return;
  4482. }
  4483.  
  4484.  
  4485. void SemanticError::PrintSTATIC_INITIALIZER_IN_INNER_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4486. {
  4487.     Coutput << "This static initializer is enclosed in an inner class, \""
  4488.             << err.insert1
  4489.             << "\", located at "
  4490.             << err.insert2
  4491.             << '.';
  4492.  
  4493.     return;
  4494. }
  4495.  
  4496.  
  4497.  
  4498. void SemanticError::PrintINNER_CLASS_REFERENCE_TO_NON_FINAL_LOCAL_VARIABLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4499. {
  4500.     Coutput << "Invalid reference in inner class \"";
  4501.     if (NotDot(err.insert1))
  4502.     {
  4503.         Coutput << err.insert1
  4504.                 << "/";
  4505.     }
  4506.     Coutput << err.insert2
  4507.             << "\" to a non-final local variable, \""
  4508.             << err.insert3
  4509.             << "\", declared in method \""
  4510.             << err.insert4
  4511.             << "\".";
  4512.  
  4513.     return;
  4514. }
  4515.  
  4516.  
  4517. void SemanticError::PrintSTATIC_PROTECTED_FIELD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4518. {
  4519.     Coutput << "The field \""
  4520.             << err.insert1
  4521.             << "\" in type \"";
  4522.     if (NotDot(err.insert2))
  4523.     {
  4524.         Coutput << err.insert2
  4525.                 << '/';
  4526.     }
  4527.     Coutput << err.insert3
  4528.             << "\" is a protected field contained in a different package than this one. "
  4529.                "Therefore, even though it may be accessible here as a simple name (if it is not hidden), "
  4530.                "it is not accessible via a field access.";
  4531.  
  4532.     return;
  4533. }
  4534.  
  4535.  
  4536. void SemanticError::PrintSTATIC_PROTECTED_METHOD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4537. {
  4538.     Coutput << "The method \""
  4539.             << err.insert1
  4540.             << "\" in type \"";
  4541.     if (NotDot(err.insert2))
  4542.     {
  4543.         Coutput << err.insert2
  4544.                 << '/';
  4545.     }
  4546.     Coutput << err.insert3
  4547.             << "\" is a protected method contained in a different package than this one. "
  4548.                "Therefore, even though it may be accessible here as a simple name (if it is not hidden), "
  4549.                "it is not accessible via a field access.";
  4550.  
  4551.     return;
  4552. }
  4553.  
  4554.  
  4555. void SemanticError::PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_LOCAL(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4556. {
  4557.     Coutput << "Ambiguous reference to field \""
  4558.             << err.insert1
  4559.             << "\" declared in (or inherited from) type \"";
  4560.     if (NotDot(err.insert2))
  4561.     {
  4562.         Coutput << err.insert2
  4563.                 << "/";
  4564.     }
  4565.     Coutput << err.insert3
  4566.             << "\" but also declared in the enclosing method \""
  4567.             << err.insert4
  4568.             << "\". Explicit qualification is required.";
  4569.  
  4570.     return;
  4571. }
  4572.  
  4573. void SemanticError::PrintINHERITANCE_AND_LEXICAL_SCOPING_CONFLICT_WITH_MEMBER(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4574. {
  4575.     Coutput << "Ambiguous reference to member named \""
  4576.             << err.insert1
  4577.             << "\" inherited from type \"";
  4578.     if (NotDot(err.insert2))
  4579.     {
  4580.         Coutput << err.insert2
  4581.                 << "/";
  4582.     }
  4583.     Coutput << err.insert3
  4584.             << "\" but also declared or inherited in the enclosing type \"";
  4585.     if (NotDot(err.insert4))
  4586.     {
  4587.         Coutput << err.insert4
  4588.                 << "/";
  4589.     }
  4590.     Coutput << err.insert5
  4591.             << "\". Explicit qualification is required.";
  4592.  
  4593.     return;
  4594. }
  4595.  
  4596.  
  4597. void SemanticError::PrintILLEGAL_THIS_FIELD_ACCESS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4598. {
  4599.     Coutput << "The type \"";
  4600.     if (NotDot(err.insert1))
  4601.     {
  4602.         Coutput << err.insert1
  4603.                 << "/";
  4604.     }
  4605.     Coutput << err.insert2
  4606.             << "\" is either not an outer type of type \"";
  4607.     if (NotDot(err.insert3))
  4608.     {
  4609.         Coutput << err.insert3
  4610.                 << "/";
  4611.     }
  4612.     Coutput << err.insert4
  4613.             << "\" or it is not accessible because this expression appears in a static region.";
  4614.  
  4615.     return;
  4616. }
  4617.  
  4618.  
  4619. void SemanticError::PrintENCLOSING_INSTANCE_ACCESS_FROM_CONSTRUCTOR_INVOCATION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4620. {
  4621.     Coutput << "An instance of \"";
  4622.     if (NotDot(err.insert1))
  4623.     {
  4624.         Coutput << err.insert1
  4625.                 << "/";
  4626.     }
  4627.     Coutput << err.insert2
  4628.             << StringConstant::US__DO
  4629.             << StringConstant::US_this
  4630.             << "\" is not accessible from an explicit constructor invocation.";
  4631.  
  4632.     return;
  4633. }
  4634.  
  4635.  
  4636. void SemanticError::PrintENCLOSING_INSTANCE_ACCESS_ACROSS_STATIC_REGION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4637. {
  4638.     Coutput << "An instance of \"";
  4639.     if (NotDot(err.insert1))
  4640.     {
  4641.         Coutput << err.insert1
  4642.                 << "/";
  4643.     }
  4644.     Coutput << err.insert2
  4645.             << StringConstant::US__DO
  4646.             << StringConstant::US_this
  4647.             << "\" is not accessible here because it would have to cross a static region in the intervening type \"";
  4648.     if (NotDot(err.insert3))
  4649.     {
  4650.         Coutput << err.insert3
  4651.                 << "/";
  4652.     }
  4653.     Coutput << err.insert4
  4654.             << "\".";
  4655.  
  4656.     return;
  4657. }
  4658.  
  4659.  
  4660. void SemanticError::PrintENCLOSING_INSTANCE_NOT_ACCESSIBLE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4661. {
  4662.     Coutput << "An instance of \"";
  4663.     if (NotDot(err.insert1))
  4664.     {
  4665.         Coutput << err.insert1
  4666.                 << "/";
  4667.     }
  4668.     Coutput << err.insert2
  4669.             << StringConstant::US__DO
  4670.             << StringConstant::US_this
  4671.             << "\" is not accessible here"
  4672.             << ". In general, an enclosing instance is accessible only in the body of an instance method, "
  4673.                "constructor (after the explicit constructor invocation, if any), "
  4674.                "initializer block, or in the initializer expression of an instance variable.";
  4675.  
  4676.     return;
  4677. }
  4678.  
  4679.  
  4680. void SemanticError::PrintZERO_DIVIDE_ERROR(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4681. {
  4682.     Coutput << "Attempt to divide by zero.";
  4683.  
  4684.     return;
  4685. }
  4686.  
  4687.  
  4688. void SemanticError::PrintZERO_DIVIDE_CAUTION(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4689. {
  4690.     Coutput << "Attempt to divide by zero.";
  4691.  
  4692.     return;
  4693. }
  4694.  
  4695.  
  4696. void SemanticError::PrintVOID_TO_STRING(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4697. {
  4698.     Coutput << "Attempt to convert an expression of type void into a String.";
  4699.  
  4700.     return;
  4701. }
  4702.  
  4703.  
  4704. void SemanticError::PrintINVALID_ENCLOSING_INSTANCE(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4705. {
  4706.     Coutput << "The super type of this type, \"";
  4707.     if (NotDot(err.insert1))
  4708.     {
  4709.         Coutput << err.insert1
  4710.                 << "/";
  4711.     }
  4712.     Coutput << err.insert2
  4713.             << "\", is immediately enclosed in type \"";
  4714.     if (NotDot(err.insert3))
  4715.     {
  4716.         Coutput << err.insert3
  4717.                 << "/";
  4718.     }
  4719.     Coutput << err.insert4
  4720.             << "\" which does not match the type of this primary expression, \"";
  4721.     if (NotDot(err.insert5))
  4722.     {
  4723.         Coutput << err.insert5
  4724.                 << "/";
  4725.     }
  4726.     Coutput << err.insert6
  4727.             << "\".";
  4728.  
  4729.     return;
  4730. }
  4731.  
  4732.  
  4733. void SemanticError::PrintCONSTRUCTOR_FOUND_IN_ANONYMOUS_CLASS(ErrorInfo &err, LexStream *lex_stream, Control &control)
  4734. {
  4735.     Coutput << "An anonymous class cannot have a constructor.";
  4736.  
  4737.     return;
  4738. }
  4739.